建表
2017-11-27 23:07 沈橙Anei 阅读(117) 评论(0) 编辑 收藏 举报CREATE TABLE Student
(Sno CHAR(9) PRIMARY KEY,
Sname CHAR(20) UNIQUE,
Ssex CHAR(2),
Sage SMALLINT,
Sdept CHAR(20)
);
insert into student values('201215121','李勇','男',20,'CS');
insert into student values('201215122','刘晨','女',19,'CS');
insert into student values('201215123','王敏','女',18,'MA');
insert into student values('201215125','张立','男',19,'IS');
insert into student values('201215126','李一平','男',18,'IS');
insert into student values('201215127','张琴','女',19,'CS');
insert into student values('201215128','王方','女',20,'MA');
insert into student values('201215129','黄林林','男',21,'IS');
CREATE TABLE Course
(Cno CHAR(4) PRIMARY KEY,
Cname CHAR(40),
Cpno CHAR(4),
Ccredit SMALLINT,
);
insert into course values('1','数据库','5',4);
insert into course values('2','数学',null,2);
insert into course values('3','信息系统','1',4);
insert into course values('4','操作系统','6',3);
insert into course values('5','数据结构','7',4);
insert into course values('6','数据处理',null,2);
insert into course values('7','C语言','6',4);
CREATE TABLE SC
(Sno CHAR(9),
Cno CHAR(4),
Grade SMALLINT,
PRIMARY KEY (Sno,Cno))
insert into sc values('201215121','1',92);
insert into sc values('201215121','2',85);
insert into sc values('201215121','3',88);
insert into sc values('201215121','4',98);