- 1、本文档共6页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
sql上机实验
1 select * from student where sex=男
2 select sno,grade from sc where cno=1
3 select sno,sname from student where year(csrq)1989
4 select sno,sname,sdept from student where sdept=信息系 and sex=女
5 select cno,ccredit from course where cname=数据库
6 select cno,cname from course where cpno=5
7 select * from student where year(csrq)=1990 and sdept=英语系
8 select * from student where (2010-year(csrq)21) and (sdept = 计算机系 or sdept = 信息系)
9 select sno,cno,grade from sc where (cno = 3 or cno = 4)
10 select cname,cpno,ccredit from course where cpno=0 and ccredit=2
1 SELECT sname,sdept, 2010-year(csrq)
FROM student
WHERE 2010-year(csrq)=20 AND 2010-year(csrq) =23;
2 SELECT DISTINCT sno
FROM sc;
3 SELECT *
FROM sc
ORDER BY cno,grade DESC;
4 SELECT grade
FROM sc
WHERE cno=1
ORDER BY grade DESC;
5 SELECT sno,grade
FROM sc
WHERE cno=1 AND grade85;
6 SELECT *
FROM student
WHERE sname like 李%;
7 SELECT sdept,sex
FROM student
WHERE sname like 张_;
8 SELECT sname,sno
FROM student
WHERE sname like __军;
9 SELECT sname,sno
FROM student
WHERE sname not like 刘% AND sdept=信息系;
10 SELECT cname,ccredit
FROM course
WHERE ccredit3 AND cname like 数据%;
SELECT sname,cname,grade
FROM sc,course,student
WHERE sc.sno=student.sno AND course.cno=sc.cno;
2 SELECT sname,cno,grade
FROM sc,student
WHERE cno=1 AND grade80 AND sc.sno=student.sno;
3 SELECT sname,cno,grade
FROM sc,student
WHERE cno 1 AND sex = 女 AND sc.sno=student.sno
ORDER BY grade DESC;
4 SELECT sname,grade
FROM sc,course,student
WHERE cname=数据库 AND sex = 男 AND sc.sno=student.sno AND course.cno=sc.cno;
5 SELECT max(grade) as 最高成绩,min(grade) as 最低成绩,avg(grade) as 平均成绩
FROM sc,course
WHERE sc.cno=course.cno and cname=数据库;
6 SELECT cno,sname,grade
FROM student,sc
WHERE student.sno=sc.sno and cno in (1,3);
7 SELECT sum(grade) as 总成绩,avg(grade) as 平均成绩
FROM student,sc
1 select sno,avg(grade) as 平均成绩 from sc grou
文档评论(0)