当数据库存在时删除ifexistsselectfromsysdatabaseswhere
ame’数据库名’dropdatabase数据库名ifexistsselectfromsysobjectswhereidobject_idN’表名’droptable表名
createdatabasemydbgousemydbcreatetablestude
t1学号s
ovarchar3
ot
ullprimarykey姓名s
amevarchar4
ot
ull性别ssexvarchar2
ot
ull出生年月sbirthdaydate所在班级classvarchar5createtableteacher1教工编号t
ovarchar3
ot
ullprimarykey教工姓名t
amevarchar4
ot
ull教工性别tsexvarchar2
ot
ull教工出生日期tbirthdaydate职称profvarchar6所在部门departvarchar10
createtablecourse1课程号c
ovarchar5
ot
ullprimarykey课程名称c
amevarchar10
ot
ull教工编号t
ovarchar3refere
cesteacher1t
ocreatetablescore
f学号s
ovarchar3
ot
ullrefere
cesstude
t1s
o课程号c
ovarchar5
ot
ullrefere
cescourse1c
o成绩degreedecimal41
i
serti
tostude
t1values108曾华男1977090195033i
serti
tostude
t1values105匡明男1975100295031i
serti
tostude
t1values107王丽女1976012395033i
serti
tostude
t1values101李军男1976022095033i
serti
tostude
t1values109王芳女1975021095031i
serti
tostude
t1values103陆君男1974060395031i
serti
toteacher1values804李诚男19581202副教授计算机系i
serti
toteacher1values856张旭男19690312讲师电子工程系i
serti
toteacher1values825王萍女19720505助教计算机系i
serti
toteacher1values831刘冰女19580814助教电子工程系i
serti
tocourse1values3105计算机导论825i
serti
tocourse1values3245操作系统804i
serti
tocourse1values6166数字电路856i
serti
tocourse1values9888高等数学831
i
serti
toscorevalues103324586i
serti
toscorevalues105324575i
serti
toscorevalues109324568i
serti
toscore
fvalues103310592i
serti
toscorevalues105310588i
serti
toscorevalues109310576i
serti
toscorevalues101310564i
serti
toscorevalues107310591i
serti
toscorevalues108310578i
serti
toscorevalues101616685i
serti
toscorevalues107616679i
serti
toscorevalues108616681
selectfromstude
t1selectfromteacher1selectfromcourse1selectfromscore
查询stude
t表中的所有记录的s
ame、ssex和class列selects
amessexclassfromstude
t1查询教师所有的单位既不重复的Depart列selectdisti
ctdepartfromteacher1查询stude
t表的所有列selectfromstude
t1查询score表中的成绩在到之间的所有数据betwee
两者之间
otbetwee
不再两者之间selectfromscorewheredegree60a
ddegree80selectfromscorewheredegreebetwee
60a
d80selectfromscorr