实验内容一、数据定义(一)基本表操作1
建立基本表在数据库 test 中建立 3 章基本表:Student、Course 和 SC(1)
创建学生表 Student(Sno,Sname,Ssex,deptno) (2)创建课程表 Course(cno,cname,tno,credit) (3)
创建学生选课表 SC(sno,cno,grade), (4)
创建老师表 teacher(tno,tname,deptno) (5)
创建系表 dept(deptno,dname) Sql 语言如下:create table student(sno int primary key,sname char(8) unique,ssex char(2),deptno int);create table course(cno int primary key,cname char(20) not NULL,tno int,credit int,foreign key (tno) references teacher(tno));create table sc(sno int,cno int,grade int,primary key(sno,cno),foreign key (sno) references student(sno),foreign key(cno) references course(cno));create table teacher(tno int primary key, tname char(8) not NULL, deptno int );create table dept( deptno int primary key, dname char(20) not NULL);2
修改基本表在 student 表中加入属性年龄 age(int 型)Sql 语言如下:a