- 创建表
1 CREATE TABLE student( 2 Sno CHAR(9) PRIMARY KEY, 3 Sname CHAR(20) UNIQUE, 4 Ssex CHAR(2), 5 Sage SMALLINT, 6 Sdept CHAR(20) 7 ); 8 CREATE TABLE course( 9 Cno CHAR(4) PRIMARY KEY,10 Cname CHAR(40) NOT NULL,11 Cpno CHAR(4),12 Ccredit SMALLINT,13 FOREIGN KEY (Cpno) REFERENCES course(Cno)14 );15 16 CREATE TABLE SC(17 Sno CHAR(9),18 Cno CHAR(4),19 Grade SMALLINT,20 PRIMARY KEY(Sno, Cno),21 FOREIGN KEY(Sno) REFERENCES student(Sno),22 FOREIGN KEY(Cno) REFERENCES course(Cno)23 );
- 表中数据
- 具体操作