SQL课堂大作业(答案).docSQL查询语言练习题目:
一、请你首先建立下面的四张表:
Student 表
NO
NAME
SEX
BIRTHDAY
CLASS
108
曾华
男
09/01/77
95033
105
匡明
男
10/02/75
95031
107
王丽
女
01/23/76
95033
101
李军
男
02/20/76
95033
109
王芳
女
02/10/75
95031
103
陆军
男
06/03/74
95031
Teacher 表
NO
NAME
SEX
BIRTHDAY
PROF
DEPART
804
李城
男
12/02/58
副教授
计算机系
856
张旭
男
03/12/69
讲师
电子工程系
825
王萍
女
05/05/72
助教
计算机系
831
刘冰
女
08/14/77
助教
电子工程系
Course 表
CNO
CNAME
TNO
3-105
计算机导论
825
3-245
操作系统
804
6-166
数字电路
856
9-888
高等数学
100
Score 表
NO
CNO
DEGREE
103
3-245
84
105
3-245
67
109
3-245
98
103
3-105
78
105
3-105
91
109
3-105
68
101
3-105
93
107
3-105
72
108
3-105
66
101
6-166
80
107
6-166
77
108
6-166
62
查询student表所记录的name,sex,class列
select sname,ssex,class
from student
显示教师工作的单位(不许重复)
select distinct depart
from teacher
以汉字属性显示student表所有记录
select sno,学号物name '姓名',ssex 性别\sbirthday '出生日期*,class,班级, from student
查询成绩在60到80之间的同学姓名
select sname
from student, score
where = and degree between 60 and 80
查询成绩为80, 85,或88的记录
select *
from score
where degree in (80,85,88)
查询'95031'班或者性别为'女'的同学记录
select *
from student
where class='95O31' or ssex='女'
以“班级”降序显示student中的记录
select *
from student
order by class desc
以eno升序、degree降序显示score中的记录
select *
from score
order by eno ,degree desc
显示'95031'班中的
SQL课堂大作业(答案) 来自淘豆网m.daumloan.com转载请标明出处.