创建学生表STUDENT,其结构如下表所示。请写出实现该创建功能的SQL语句。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了创建学生表STUDENT,其结构如下表所示。请写出实现该创建功能的SQL语句。相关的知识,希望对你有一定的参考价值。
参考技术A create table student(XH CHAR(8) NOT NULL PRIMARY KEY,
XM CHAR(8) ,
XB CHAR(2),
NL INT,
CJ DECIMAL(3,1),
ZP IMAGE,
RQ DATETIME NOT NULL
CONSTRAINT chk_XB CHECK (XB='男' OR XB='女'),
CONSTRAINT chk_NL CHECK (NL>=16 AND NL<=25)
)
--添加说明
comment on column STUDENT.XH
is '学号,主键';
comment on column STUDENT.XM
is '姓名';
comment on column STUDENT.XB
is '性别';
comment on column STUDENT.NL
is '年龄';
comment on column STUDENT.CJ
is '成绩';
comment on column STUDENT.ZP
is '照片';
comment on column STUDENT.RQ
is '日期';本回答被提问者采纳 参考技术B create table student(xh char(8) not null primary key,
xm char(8) null,xb char(2) null check(xb in('男','女')),
nl int null check(nl >=16 and nl<=25),
cj decimal(3,1) null,zp image null,rq datetime not null)
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'学号,主键' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'xh'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'姓名' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'xm'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'性别' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'xb'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'年龄' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'nl'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'成绩' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'cj'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'照片' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'zp'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'日期' ,
@level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'student',
@level2type=N'COLUMN',@level2name=N'rq'
GO 参考技术C create table student(
XH char[8] not null primary key,
XM char[8],
XB char[2],
NL int,
CJ decimal[3,1],
ZP image,
RQ datetime not null,
CONSTRAINT chk_xb CHECK (XB='男' OR XB='女'),
CONSTRAINT chk_NL CHECK (NL>=16 AND NL<=25)
)
以上是关于创建学生表STUDENT,其结构如下表所示。请写出实现该创建功能的SQL语句。的主要内容,如果未能解决你的问题,请参考以下文章
设有一数据库,包括四个表:学生表(Student)课程表(Course)成绩表(Score)以及教师信息表(Teacher)。四个表的结构分别如表1-1的表~表所示,数据如表1-2的表
用SQL语句在SQL Server2000下实现如下功能。所用数据库表结构如下: student(学生表):(sno,学号,9字