题目
有以下几张表
– student(stu_no,name,sex,department<所在系>,birthday)
– course(course_no,course_name,credit<学分>,department)
– Choosing_Courses(stu_no,course_no,score)
a. 查询所有没有被选过的课程。
b. 查询选了“数据库原理”课程的所有学生的学号和姓名。
c. 查询选课总门数最多的学生的姓名及其选课总学分。
d. 查询选课门数最多的学生姓名及其选课门数。
e. 查询选了其所在系开始所有课程的学生姓名
建表
学生表
--建表
create table YZY_student2(
stu_no number(5) primary key,
name varchar2(10) NOT NULL,
sex varchar2(5) check(sex='男' or sex='女'),
department varchar2(10) NOT NULL,
birthday date);
--创建序列
CREATE SEQUENCE seq_stu_no
MINVALUE 1
START WITH 1
INCREMENT BY 1
CACHE 10
--插入数据
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'王瀚','男','计算机系','13-6月-98');
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'马丽','女','数学系','25-8月-99');
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'高天天','男','统计系','21-10月-99');
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'尹明明','女','数学系','26-1月-99');
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'范强','男','计算机系','15-8月-97');
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'魏春','女','统计系','25-8月-99');
INSERT INTO YZY_student2
VALUES (seq_stu_no.nextval,'赵起','男','计算机系','5-10月-97');
INSERT INTO YZY_student2
VALUES (seq_stu_no.n