首页 > 代码库 > 数据库学习笔记(七)

数据库学习笔记(七)

--在数据库test01中新建课程信息表
USE test01
GO
CREATE TABLE course
(
courseno nchar(6) NOT NULL,
cname nchar(20) NULL,
type nchar(8) NULL,
period tinyint NULL,
credit numeric(4, 1) NULL,
CONSTRAINT PK_course PRIMARY KEY CLUSTERED(Courseno asc)
)ON [PRIMARY] 


--向test01中建立学生分数表score
--并且阴招两个主键的排序为升序
USE test01
CREATE Table score(
studentno nchar(10) NOT NULL,
courseno nchar(6) NOT NULL,
usually numeric(6, 2) NULL,
final numeric(6, 2) NULL,
CONSTRAINT PK_score PRiMARY KEY CLUSTERED(
studentno asc,
courseno asc
)



--向test01中天剑teacher的表
USE test01
GO
CREATE TABLE teacher(
teacherno nchar(6) NOT NULL,
tname nchar(8) NULL,
major nchar(10) NULL,
prof nchar(10) NOT NULL,
department nchar(12) NULL,
CONSTRAINT PK_teacher PRIMARY KEY CLUSTERED(
teacherno asc
)

)

数据库学习笔记(七)