当前位置:首页 » 编程语言 » sql数据库试题

sql数据库试题

发布时间: 2022-05-21 09:28:44

sql数据库选择题,9~14题。

答案是accdac

9. A order by 是按列分组
10. C is null 表示为“空”,is not null 表示为“非“”
11. C cno在sc表中有,故不需用到course表
12. D 显然,三个表都要用到
13. A 其实可以根据英文单词来记忆,insert就是插入的意思,update就是更新的意思,如果你玩游戏的话,当游戏要更新补丁的时候就会有“update”字样
14. C A是创建数据库,B是创建视图,C是创建表,D是修改表,alter是修改的意思

注:个人建议这种一眼看过去就知道答案的题目一定要完全掌握,其实不难的,不需要你会英语,把单词记住就好了。

Ⅱ SQL数据库填空题 求大神

1、数据库管理技术经历了____人工管理___ ____文件管理______ __数据库系统___ 三个阶段
2 .关系模型有 ___实体完整性____,___参照完整性____ ,____用户定义的完整性___ 三类完整性。
4、SQL SERVER 中的编程语言就是________________PL/SQL_____________语言。
5、PL/SQL 有两种类型的游标:___显式游标____ 和____显式游标___ 。
6、DBMS通常提供授权功能来控制不同的用户访问数据库中数据的权限,其目的是为了数据库的_____安全性____

Ⅲ SQL数据库试题~~~~~~~~~~

updateStudentsetsex='女'wherename='张三'returningageinto:var

Ⅳ SQL数据库题

第一个
select*fromswheresnoin(
selectsnofromscwherecnoin(
selectcnofromcwherecteacher='李明'
)
)

第二个
selects.sname,sc,sum(sgrade)fromsleftjoinscons.sno=sc.sno
wheresc.sgrade>=60
groupbys.sname
第三个
createindexc_cno_indexONc(cno)

Ⅳ sql数据库一道试题帮忙做做

---1)
创建一张学生表,包含以下信息,学号,姓名,年龄,性别,家庭住址,联系电话
CREATE
TABLE
student
(

[id]
[int]
IDENTITY(1,1)
NOT
NULL,

[student_id]
[nvarchar](50)
NULL,

[studen_name]
[nvarchar](50)
NULL,

[age]
[int]
NULL
,

[sex]
[nvarchar](5)
NULL,

[address]
[nvarchar](200)
NULL,

[tel]
[nvarchar](20)
NULL
)
--2)
修改学生表的结构,添加一列信息,学历
ecation
alter
table
student
add
ecation
nvarchar(10)
NULL
--3)
修改学生表的结构,删除一列信息,家庭住址
alter
table
student
drop
column
address
--5)
修改学生表的数据,将电话号码以11开头的学员的学历改为“大专”
update
student
set
ecation='大专'
where
tel
like
'11%'
--6)
删除学生表的数据,姓名以C开头,性别为‘男’的记录删除
delete
student
where
studen_name
like
'C%'
and
sex='男'
--7)
查询学生表的数据,将所有年龄小于22岁的,学历为“大专”的,学生的姓名和学号示出来
select
studen_name,student_id
from
student
where
age<12
and
ecation='大专'
--8)
查询学生表的数据,查询所有信息,列出前25%的记录
select
TOP
25
PERCENT
*
from
student
--9)
查询出所有学生的姓名,性别,年龄降序排列
select
studen_name,sex,age
from
studen
order
by
age
desc
--10)
按照性别分组查询所有的平均年龄
select
avg(age)
as
age
from
studen
group
by
sex

Ⅵ SQL数据库试题求解

------------------------------------------------------
create table students(st_id varchar(20),st_name varchar(50),sex varchar(10))

insert into students(st_id,st_name,sex)
select 'st001','张杰', '男' union all
select 'st002', '公孙燕飞' ,'男' union all
select 'st003', '王楠', '女' union all
select 'st004', '王伟', '男' union all
select 'st005','李燕纹', '女' union all
select 'st006', '孙武' ,'男'
select *
from students

create table teachers(t_id varchar(20),t_name varchar(50),t_lesson varchar(50))

insert into teachers

select 't001', '张老师' ,'数学' union all
select 't002', '李老师', '英语'

delete from results
create table results(r_id varchar(20),r_fenshu int,r_stid varchar(50),r_tid varchar(50))

insert into results
select 'r001','90', 'st001', 't002' union all
select 'r002', '68', 'st005', 't001' union all
select 'r003', '92', 'st003' ,'t001' union all
select 'r004', '82', 'st006', 't002' union all
select 'r005', '70', 'st002', 't002' union all
select 'r006', '86', 'st002', 't001' union all
select 'r007', '57', 'st003', 't002' union all
select 'r008', '76', 'st006', 't001' union all
select 'r009', '55', 'st001', 't001' union all
select 'r010', '77', 'st004', 't002' union all
select 'r011', '58', 'st005', 't002'
----------------------------------------------------------
1.
select st_id
from students
where st_name = '王伟'

2.select st_id,st_name
from students
where st_name like '__燕%'

3 select st_name,len(st_name) as 名字长度
from students
where sex ='男'

4 select min(r_fenshu) as 最低分数
from teachers t inner join results r on t.t_id =r.r_tid
where t_lesson ='数学' --这个是不考虑成绩中有null值的
5 select s.st_id as 学生编号,r_fenshu as分数,r_tid as 课目号
from students s inner join results r on s.st_id =r.r_stid
where s.sex='女'
--如果还要课目的名称的话请用下面的
select s.st_id as 学生编号,r.r_fenshu as 分数,r.r_tid as 课目号,t.t_lesson as 课目名称
from students s inner join results r on s.st_id =r.r_stid
inner join teachers t on r.r_tid = t.t_id
where s.sex='女'

6 select avg(r.r_fenshu)
from results r inner join teachers t on r.r_tid = t.t_id
where t.t_lesson='英语'

7.select *
from students s inner join results r on s.st_id =r.r_stid
inner join teachers t on r.r_tid = t.t_id
where s.st_id in (select top 2 st_id from students order by st_id desc)
order by s.st_id desc

8 select sum(r.r_fenshu) as 总分
from results r inner join students s on r.r_stid =s.st_id
where s.st_name = '王楠'
9.select distinct s.st_id,s.st_name
from students s inner join results r on s.st_id = r.r_stid
where st_id not in (select r_stid from results where r_fenshu<60) and st_id not in (select r_stid from results where r_fenshu >=90)

10 update results
set r_fenshu = r_fenshu + 10
--如果分数不可能大于100请用这句 set r_fenshu = case when r_fenshu + 10 <=100 then r_fenshu + 10 else 100 end
where r_stid in (select st_id from students where sex='女')

1 进阶题
select t.t_name,count(*)
from students s,teachers t,results r
where r.r_tid = t.t_id
and s.st_id =r.r_stid
and r.r_fenshu >= 60
and t.t_id in (select t_id from teachers where t_lesson='数学' )
--and t_lesson='数学'
group by t.t_name

2

select top 1 sum(r_fenshu) as 总分,t.t_lesson,t_id,t_name
from results r,teachers t
where r.r_tid = t.t_id
group by t.t_lesson,t_id,t_name
order by 总分 desc

3. delete from results where r_stid in (select r_stid from results group by r_stid having count(r_tid) = 1)

1 选做题
select d.name from sysobjects d where d.xtype='U'
2.select top 5 * from students order by newid()

Ⅶ sql 数据库习题谢谢

1. select '类别为:'+tushuleibie 图书分类 from T_Book
2. select shuming 书名,zuozhe 作者,jiage*0.7 价格 from T_Book where chubanshe ='机械工业出版社'
3. select shuming 书名,zuozhe 作者,jiage 价格, chubanshe 出版社 from T_Book where jiage between 30 and 60
4. select top 3 shuming 书名,zuozhe 作者,chubanshe 出版社, jiage 价格 from T_Book order by jiage desc

6.select chubanshe 出版社,AVG(jaige) 平均价,MAX(jiage) 最高价 ,MIN(jaige) 最低价 from T_Book group by chubanshe order by SUM(jiage) desc

10.select top 1 chubanshe 出版社, count(*) 出版图书个数 from T_Book group by chubanshe order by COUNT(*) desc
book表的做好了 reader的自己做吧 字段名我用拼音做代替的 你自己替换成你表中的字段

Ⅷ 求sql数据库考试题答案

1.create database Readbook
on
(name=Readbook_data,filename='D:\server\Readbook_data.mdf',size=2mb,maxsize=10mb,filegrowth=1mb)
log on
(
name=Readbook_log,
filename='D:\server\Readbook_log.ldf',size=1mb,maxsize=5mb,filegrowth=1mb
)
go
2.use mybase
go
alter database mybase
add log file
(
name=Readbook2_log,
filename='D:\server\mybase2_log.ldf',size=2mb,maxsize=10mb,filegrowth=1mb
)
go
3.alter database mybase
remove file Readbook2_log

Ⅸ 急求SQL数据库练习题

楼上的--理论很多不太使用:ㄨinsert -增加语句用法 insert into(Name,Sec)values("张三","李四") --这个语句1.习题:插入学员信息 Name,Sex,Age,Address (地址可为null) 要有自动标识列。 2.实现一次插入多行。3.把原有表中的某个字段 移到新表中 提示:select <字段> into newtable from <原表> ㄨdelecte --删除语句delecte from <表> [where<条件>]例题:上表中 --删除 年龄是66和地址为null 信息 (年龄与地址自己添加) ㄨupdate--更新语句update set <条件> where[限制条件]例题:把年龄大于50岁的 更新为49岁 其余条件自己加 ㄨselect --查询语句select <字段1>,<字段2> from <表> where [条件]例题:从表1、表2中查找相同字段并且 把相同字段存放到新的表中这里子查询就不多说了。这些题很基础你试一试。

热点内容
搭建邮箱中继服务器 发布:2024-04-27 16:40:42 浏览:197
我的世界的神奇宝可梦服务器 发布:2024-04-27 16:28:28 浏览:588
君威高配有哪些配置 发布:2024-04-27 16:27:54 浏览:198
安卓九彩蛋如何换颜色 发布:2024-04-27 16:10:36 浏览:504
安卓711如何打开隐藏彩蛋 发布:2024-04-27 16:04:53 浏览:813
写一个脚本让电脑按时自动关机 发布:2024-04-27 16:00:06 浏览:929
php框架排行2018 发布:2024-04-27 15:49:26 浏览:357
地下城与勇士怎么设置二级密码 发布:2024-04-27 15:36:17 浏览:946
headerjava 发布:2024-04-27 15:34:52 浏览:784
android进度条显示 发布:2024-04-27 15:34:49 浏览:351