《数据库原理》实验1

9 5 6 7 10 8 8 54 58 58 70 65 Null Null

3、在SPJ数据库中建立课本第二章习题5中的四个表,并输入数据。 七、出现问题及解决办法

如某些操作无法执行,如何解决?

create database student on (NAME='stu', LOG ON

(name='stu_log',

CREATE TABLE Student

(Sno CHAR(9)PRIMARY KEY, Sname CHAR(20) UNIQUE, Ssex char(2), Sage SMALLINT, Sdept CHAR(20) );

filename='D:\\9\\stu_log.ldf', size=5MB, filegrowth=1MB)

filename='D:\\9\\stu_data.mdf', SIZE=5MB, maxsize=500MB,

filegrowth=10%)

create table Course

create table SC

insert into student

values('','张向东','男',20,'IS'); insert into student

values('','张向丽','女',20,'IS'); insert into student

values('','王芳','女',20,'CS'); insert

--向student表插入信息 insert into student

values('','赵菁菁','女',23,'CS'); insert into student

values('','李勇','男',20,'CS'); insert into student

values('','张力','男',19,'CS'); insert into student

values('','张衡','男',18,'IS'); (Sno char(9), Cno char(4), Grade smallint, primary key (Sno,Cno),

foreign key (Sno) REFERENCES Student(Sno), foreign key (Cno) references Course(Cno) );

(Cno char(4) primary key, Cname char(40), Cpno char(4), Ccredit smallint,

foreign key (Cpno) REFERENCES Course(Cno) );

into student

values('','王民生','男',25,'MA'); insert into student

values('','王小民','女',18,'MA'); insert into student

values('','李晨','女',22,'MA'); insert into student

values('','张毅','男',20,'WM'); insert into student

values('','杨磊','女',20,'EN'); insert into student

values('','李晨1','女',19,'MA'); insert into student

values('','张丰毅','男',22,'CS'); into studen

>>鐏炴洖绱戦崗銊︽瀮<<
12@gma联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4