内容发布更新时间 : 2024/11/14 12:51:25星期一 下面是文章的全部内容请认真阅读。
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 student
values('','李蕾','女',21,'EN'); insert into student
values('','刘社','男',21,'CM'); insert into student
values('','刘星耀','男',18,'CM'); insert into student
values('','李贵','男',19,'EN'); insert into student
values('','林自许','男',20,'WM'); insert into student
values('','马翔','男',21,''); insert into student
values('','刘峰','男',25,'CS'); insert into student
values('','刘站强','男',22,'');
insert
insert into student
values('','李婷婷','女',18,''); insert into student
values('','严丽','女',20,''); insert into student
values('','朱小鸥','女',30,'WM');
--向course插入信息 insert into Course
values('1','数据库','5',4); insert into Course
values('2','数学','',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','数据处理','',2); insert into Course
values('7','PASCAL语言','6',4); insert into Course
values('8','大学英语','',4); insert into Course
values('9','计算机网络','',4); insert into Course
values('10','人工智能','',2);