资源描述:
《SQL_面试题含建表语句》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Student(S#,Sname,Sage,Ssex)学牛•表iCourse(C#,Cname,T#)课程表SC(S#,C#,score)成绩表Teacher(T#,Tname)教师表建表语句CreatetableStudent(S#number(4),Snamevarchar2(9)notnull,Ssexvarchar2(3),Sagedate,constraintStudent_S#_Pkprimarykey(S#));insertintoStudentvalues(1001;李志国T男',to_date('26・9・1985Tdd・m
2、m・yyyy'));insertintoStudentvalues(1002;李甜甜:'女,,to_date('6-2-1987';dd-mm-yyyy,));insertintoStudentvalues(1003/张小燕T女to_dateCl8-ll-19847dd-mm-yyyy'));insertintoStudentvalues(1004/王菲T男:to_date('3・6-1985Tdd-mm-yyyy'));insertintoStudentvalues(1005/杜宇女:to_date('25-4-1986Tdd-mnvyy
3、yy'));insertintoStudentvalues(1006,'彭大生T男,/to_date('28-12-1988'/'dd-mm-yyyy'));insertintoStudentvalues(1007;王亮,,'男',to_date(':l•&1983Tdd・mm・yyyy'));insertintoStudentvalues(1008;赵婷婷T^:,/to_date(,2-2-1984I;dd-mm-yyyy,));CreatetableTeacher(T#number(4),Tnamevarchar2(9)notnull,c
4、onstraintTeacher_T#_Pkprimarykey(T#));insertintoTeachervalues(2001J李华');insertintoTeachervalues(2002J王力宏insertintoTeachervalues(2003/叶平');insertintoTeachervalues(2004j王倩倩');insertintoTeachervalues(2005,李莉莉");CreatetableCourseC#number(3),Cnamevarchar2(12)notnull,T#number(4),
5、constraintCourse_C#_Pkprimarykey(C#),constraintCourse_T#_Fkforeignkey仃#)referencesTeacher(T#));insertintoCoursevalues(001/企业管理2003);insertintoCoursevalues(002,'马克思:2001);insertintoCoursevalues(003,'00‘11&11’UML',2002);insertintoCoursevalues(004,'数据库',2004);insertintoCourse
6、values(005/英语2005);insertintoCoursevalues(006,'人学语文',2005);insertintoCoursevalues(007/现代企业2003);CreatetableSCS#number(4),C#number(4),scorenumber(3),constraintSC_S#_C#_Pkprimarykey(S#,C#),constraintSc_S#_Fkforeignkey(S#)referencesStudent(S#),constraintSc_C#_Fkforeignkey(C#
7、)referencesCourse(C#));insertintoSCvalues(1001,l/87);insertintoSCvalues(1001,3,66);insertintoSCvalues(1001,2,77);insertintoSCvalues(1001,5,45);insertintoSCvalues(1001z7,67);insertintoSCvalues(1002426);insertintoSCvalues(1002,l/86);insertintoSCvalues(1003,3/67);insertintoSCv
8、alues(1003,乙97);insertintoSCvalues(1003,5,67);insertintoSCvalues(1004,5,78);insert