数据库建表和加入数据操作(sql server)

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
values('95002','刘晨',0,19,'IS')
go
insert into Student
values('95003','王敏',0,18,'MA')
go
insert into Student
values('95004','张力',1,19,'IS')
create database Studenttudentmanagement
go
create table Student
( Sno char(9) primary key,
Sname char(8) not null,
Ssex bit not null,
go
insert into sc
values('95001',2,85)
go
insert into sc
values('95003',3,88)
go
insert into sc
values('95002',2,90)
go
insert into sc
Sage tinyint null,
Sdept char(4) null,
)
go
create table Course
(
Cno tinyint primary key,
Cname char(20) not null,
Cpno tinyint null,
go
insert into sc
values('95013',5,87)
go
foreign key (Cno) references Course(Cno),
)
go
use Studentmanagement
go
insert into Student
values('95001','李勇',1,20,'CS')
go
insert into Student
values(2,'数学',2)
go
insert into Course
values(3,'信息系统',1,4)
go
insert into Course
values(4,'操作系统',6,3)
go
insert into Course
values(5,'数据结构',7,4)
go
insert into Course(Cno,Cname,Ccredit)
values(6,'数据处理',4)
go
insert into Course
values(7,'PASCAL语言',6,4)
go
insert into sc
values('95001',1,92)
go
insert into Student
values('95013','王玲',0,21,'EN')
go
insert into Course
values(1,'数据库',5,4)
go
insert into Course(Cno,Cname,Ccredit)
values('95002',3,80)
go
insert into sc
values('95013',6,79)
go
insert into sc
values('95004',7,65)
go
insert into sc
values('95003',4,78)
Ccredit int not null,
)
go
create table sc
(
Sno char(9) ,
Cno tinyint,
Grade tinyint null,
primary key(Sno,Cno),
foreign key (Sno) references Student(Sno),
相关文档
最新文档