一、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的一些題目