创建数据表

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

创建数据表

1.创建一个名为'teacher1f'的数据表create table teacher1f

(

tno int identity(1,1),

tname char(20),

title char(6)default'讲师', major char(20),

sdept char(30),

tel char(30)

)

创建一个名为'teacher2f'的数据表create table teacher2f

(

tno int,

tname nchar(10),

age int,

sex nchar(10),

title nchar(10),

major nchar(10),

sdept nchar(10)

)

创建一个名为'coursef'的数据表create table coursef

(

cno nchar(10)not null, cname nchar(10),

studyscore int,

studytime int

)

创建一个名为'gradef'的数据表create table gradef

(

cno nchar(20),

tno char(20),

grade int

)

2.修改teacher1f的tno为位字符

alter table teacher1f

alter column tno char(20)

3.插入'age'列

alter table teacher1f

add age int

4.插入'sex'列

alter table teacher1f

add sex char(30)

5.删除'Tel'列

alter table teacher1f

drop column Tel

6.删除表teacher1f

drop table teacher1f

7.创建表(复制信息)

select*

into boysf

from teacher1f

where sex='男'

--把sex为'男'的教师信息筛选出来并放在boysf新表中

select*

into teacher3f

from teacher1f

--把teacher1f中的学生信息放在teacher3f新表中(复制表)

相关文档
最新文档