学生表:Student(Sno,Sname,Ssex,Sage,Sdept) Sno为主码; 课程表:Course(Cno,Cname,Cpno,Credeit)

2024-11-06 17:23:07
推荐回答(2个)
回答1:

应该还有个选课表sc(sno,cno,grade)吧?
1.select distinct sdept from student;
2.select cname,count(sno) from course,sc where course.cno=sc.cno group by cname;
3.create table 学生2(学号 char(10) primary key,姓名 char(10),性别 char(2),出生日期 smalldatetime,所在系 char(10));

回答2:

1、SELECT DISTINCT Sdept FROM Student;
2、SELECT COUNT(DISTINCT Cpno)
FROM Course
WHERE Cname = ' English ' ;
3、CREATE TABLE Student2
(Sno CHAR(9) PRIMARY KEY,
Sname CHAR(20) UNIQUE,
Ssex CHAR(2) ,
Sbirthday SMALLINT,
Sdept CHAR(20)
);