一、1.C,2.D,3.A,4.D,5.D,6.C,7.D,8.D,9.C,10.D
二、1.A,2.A,3.A,4.A,5.B.6.A,7.B,8.B,9.B,10.B
自己做着玩的,非标准答案~
② SQL语句题目
(5)A
(6)B
1.create index IDX_Readers_1 on Readers(Rname asc);
create index IDX_Books_1 on Books(Btitle desc)
4,5不知道表结构及表之间的主键外键关系就不写了
6.insert into readers(id,name,type) values ('200406002','路宏','2');
任务2:查询总量select count(1) from books;(如果books表无重复记录)
group by 出版社即可按出版社分组;
任务三:不知道表结构就不写sql了
③ 数据库SQL语句题目急求大神帮忙
createdatabasecollege
on
(name='college_data',
filename='D:college.mdf',
size=10mb,
filegrowth=10%
)
logon
(name='college_log',
filename='D:college.ldf',
size=2mb,
filegrowth=10%
)
createtables
(
学号char(10)primarykey,
姓名varchar(50),
性别char(2),
班级char(10),
年龄int
)
createtablec
(
课程号char(10)primarykey,
课程名varchar(50),
教师姓名varchar(50),
周课时数int,
备注varchar(200)
)
createtablesc
(
学号char(10),
课程号char(10),
成绩int
)
--查询年龄在20-23之间男学生的信息
select*fromswhere性别='男'and年龄between20and23
--查询各班级人数
select班级,count(学号)as人数fromsgroupby班级
--查询选修数据库的学生学号成绩
selectsc.学号,sc.课程号fromcinnerjoinsconc.课程号=sc.课程号wherec.课程名='数据库'
--查询年龄大于平均年龄的学生
select*fromswhere年龄>(selectavg(年龄)froms)
--统计课程1的最高最低平均成绩
selectmin(成绩)as最低成绩,max(成绩)as最高成绩,avg(成绩)as平均成绩fromscwhere课程号='1'
--增加一个学生
insertintos(学号,姓名,性别)values('123456','张三','女')
--删除课程号123
deletefromcwhere课程号='123'
--将所有学生加1岁
select*,年龄+1as年龄加一froms---在结果加一
updatesset[年龄]=年龄+1--在表中修改
--删除表
droptables,c,sc
④ sql题目。
主键
单元格
⑤ 高分悬赏几道计算机SQL数据库的题!做出来了先支付100分,要是满意的话,在加赏50~
1. 查询雇员(employee)的姓和名
Select substring(username,1,1) as 姓 from employee
Select substring(username,2,2) as 名 from employee
2. 查询雇员的姓名
Select username from employee
3. 查询雇员数
Select count(*) from employee
4. 查询雇员的姓名和职务
Select username,,ty from employee
5. 查询雇员的工龄
Select year(getdate())-开始工作日期 as 工龄 from employee
任务2:条件查询
1. 查询雇员(employee)从事"Sales Representative"职务的有哪些人
Select * from employee where ty=’ Sales Representative’
2. 查询工龄超过15年的雇员
Select * from employee where cast( (year(getdate())-开始工作日期) as int)>=15
3. 查询姓以a开头的雇员
Select * from employee where username like ‘a%’
4. 查询姓的开头字母在m以后的雇员
Select * from employee where cast((substring(username,1,1) as varchar)>=’m’
5. 认为hire_date是雇员生日,查询巨蟹座的雇员
Select * from employee where birthday between ‘6-22 ‘ and ‘7-22’
任务3:联合查询
1. 查询雇员和雇员职位
Select a.id,b.ty from employee, as a,jobs as b
2. 查询雇员、雇员职位和雇员所在出版社
Select a.id,b.ty, b.publishing from employee as a,jobs as b on a.id=b.id
3. 查询雇员、雇员工资、雇员离本职位最高工资的差值
select a. ID,a.username,a.[雇员工资],b.[最高工资]-a.[雇员工资] as [差值] from employee a,jobs b where a.[职位]=b.[职位]
⑥ SQL期末考试题,来个大神帮解答一下
select fph from mz_brsf
whereje > 200;
2.select sum(je) from mz_brsf
where sfsj >= '2012-01-01'
and sfsj < '2012-02-01';
3.delete from mz_bfsf
where cfh is null;
4.update mz_bfsf
set substr(sfsj,1,4) =2013
where ks ='内科' ;
5. select ks, sum(je) from mz_bfsf
group by ks
having sum(je) >500;
6.select top 2 ys,sum(je)
from mz_bfsf
group by ys
order by sum(je) desc;
7.update a
set a.zc = b.zc
from mz_bfsf a,mz_brxx b
where a.ys = b.ys
⑦ 关于数据库SQL的一些题目