学生表
Student
学号
姓名
性别
出生年月日
所在班级
课程表
Course
课程号
课程名称
教师编号
成绩表
Score
学号
课程号
成绩
教师表
Teacher
教师编号
教师名字
教师性别
出生年月日
职称
所在部门
-----往数据表中添加数据
#添加学生信息
#添加教师表
#添加课程表
#添加成绩表
查询练习:
1 查询student表中的所有记录
select * from student;
2 查询student表中的所有记录的 sname,ssex,和class列
select sname, ssex, class from student
3 查询教师所有的单位即不重复的depart 列
distinct 排重
select distinct depart from student;
4 查询score 表中成绩在60-80之间的所有记录
---查询区间 between ...and ...
select * from score where degree between 60 and 80
select * from score where degree > 60 and degree < 80
5 查询score表中成绩为85,86,或88的记录
表示或者关系的查询 in
select * from score where degree in(85,86,88)
6 查询 student 表中”95031”班或性别为“女”的同学的记录
--- or 表示或者
select * from student from class = "95031" or ssex = "女"
7 以class 降序查询student 表中的所有记录
升序,降序如何表达 asc 升序 desc 降序
select * from student order by class desc
8 以cno升序,degree降序查询score 表的所有记录
select * from student order by cno asc,degree desc
9 查询“95031”班的学生人数
select count(*)from student where class ="95031";
10 查询score 表中 的最高分的学生学号和课程号(子查询或者排序)
select sno,cno from score where degree = (select max (degree) from score )
11.