数据库作业---例题.doc

上传人:pu****.1 文档编号:556056182 上传时间:2022-09-05 格式:DOC 页数:9 大小:226KB
返回 下载 相关 举报
数据库作业---例题.doc_第1页
第1页 / 共9页
数据库作业---例题.doc_第2页
第2页 / 共9页
数据库作业---例题.doc_第3页
第3页 / 共9页
数据库作业---例题.doc_第4页
第4页 / 共9页
数据库作业---例题.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《数据库作业---例题.doc》由会员分享,可在线阅读,更多相关《数据库作业---例题.doc(9页珍藏版)》请在金锄头文库上搜索。

1、-例1SELECT Sno,Snamefrom Student;关系代数:-例2SELECT Sname,Sno,Sdeptfrom Student;关系代数:-例3SELECT *FROM Student;关系代数:-例4select Sname ,2004-sagefrom Student;关系代数:-例5SELECT Sname,Year of Birth:,2004-Sage,LOWER(Sdept)FROM Student;关系代数:-例6SELECT Snofrom SC;关系代数:-例7SELECT Snamefrom StudentWHERE Sdept=CS;关系代数:-例8

2、SELECT Sname,SageFROM StudentWHERE Sage20;关系代数:-例9SELECT DISTINCT Snofrom SC WHERE Grade60;关系代数:-例10SELECT Sname,Sdept,SageFrom StudentWHERE Sage NOT BETWEEN 20 AND 23;关系代数:-例11SELECT Sname,Sdept,SageFrom StudentWHERE Sage BETWEEN 20 AND 23;关系代数:-例12SELECT Sname,Ssexfrom StudentWHERE Sdept IN (CS,MA

3、,IS);关系代数:-例13SELECT Sname ,SsexFROM StudentWHERE Sdept NOT IN(CS,MA,IS);关系代数:-例14SELECT *FROM StudentWHERE Sno LIKE 200215121;200215121 李勇 男 20 CS 8关系代数:-例15select Sname,Sno,Ssexfrom StudentWHERE Sname LIKE 刘%;刘晨 200215122 女 关系代数:-例16select Sname from StudentWHERE Sname LIKE 李_;李勇 关系代数: -例17SELECT

4、Sname,Snofrom StudentWHERE Sname LIKE _敏%;王敏 200215123 关系代数:-例18SELECT Sname,Sno,Ssexfrom StudentWHERE Sname NOT LIKE刘%;李勇 200215121 男 王敏 200215123 女 张立 200215125 男 关系代数:-例19select Cno,Ccreditfrom CourseWHERE Cname LIKE DB_DesignESCAPE;验证通过关系代数:-例20SELECT *FROM CourseWHERE Cname LIKE DB_%I_ _escape;

5、验证通过关系代数:-例21SELECT Sno,Cnofrom SCWHERE Grade IS NULL;验证通过关系代数:-例22SELECT Sno,Cnofrom SCWHERE Grade is not null;200215121 1 200215121 2 200215121 3 200215122 2 200215122 3 关系代数:-例23select Snamefrom Student where Sdept=CSAND Sage2;200215121 -例33SELECT Student.*,SC.*FROM Student,SCWHERE Student.Sno=sc

6、.Sno;200215121 李勇 男 20CS 80200215121 1 92 200215121 李勇 男 20CS 80200215121 2 85 200215121 李勇 男 20CS 80200215121 3 88 200215122 刘晨 女 19CS 83200215122 2 90 200215122 刘晨 女 19CS 83200215122 3 80 关系代数:-例34SELECT Student.Sno,Sname,Ssex,Sdept,Cno,Gradefrom Student ,SCWHERE Student.Sno=SC.Sno ; 200215121 李勇

7、男 CS 1 92 200215121 李勇 男 CS 2 85 200215121 李勇 男 CS 3 88 200215122 刘晨 女 CS 2 90 200215122 刘晨 女 CS 3 80 关系代数:-例35SELECT FIRST.Cno,SECOND.Cpnofrom Course FIRST,Course SECONDWHERE FIRST.Cpno=SECOND.Cno;1 7 3 5 4 NULL5 6 7 NULL关系代数:-例36select Student.Sno,Sname,Ssex,Sage,Sdept,Cno,Gradefrom Student LEFT J

8、OIN SC ON (Student.Sno=SC.Sno);200215121 李勇 男 20CS 1 92 200215121 李勇 男 20CS 2 85 200215121 李勇 男 20CS 3 88 200215122 刘晨 女 19CS 2 90 200215122 刘晨 女 19CS 3 80 200215123 王敏 女 18MA NULLNULL200215125 张立 男 19IS NULLNULL-例37SELECT Student.Sno,Snamefrom Student,SCWHERE Student.Sno=SC.Sno and SC.Cno=2and SC.G

9、rade80;200215121 李勇 200215122 刘晨 关系代数: -例38select Student.Sno,Sname,Cname,Gradefrom Student,SC,Coursewhere Student.Sno=SC.Sno and SC.Cno=Course.Cno;200215121 李勇 数据库 92 200215121 李勇 数学 85 200215122 刘晨 数学 90 200215121 李勇 信息系统 88 200215122 刘晨 信息系统 80 关系代数:-例39select Sno,Sname,SdeptFROM Studentwhere Sdept in(SELECT

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号