全球旧事资料 分类
实验:SQLServer2005数据库的基本操作
实验目标:
掌握SQLServer2005表的基本概念掌握SQLServer2005使用TSQL表的创建、删除、修改
实例引导:创建数据库定义一个数据库数据库的名字数据库的大小数据库所在的文件createdatabasesampleo
primary
amesampledatafile
amecdatasamplemdfsize10mbmaxsize15mbfilegrowth20logo
amesamplelogfile
amecdatasampleldfsize3mbmaxsize5mbfilegrowth1mb1)、向数据库中添加文件
falterdatabasesampleaddfile
ametest1dat2file
amect1dat2
dfsize5mbmaxsize100mbfilegrowth5mb2)、向数据库中添加由两个文件组成的文件组alterdatabasesampleaddfilegrouptest1fg1goalterdatabasesampleaddfile
ametest1dat3file
amecdatat1dat3
dfsize5mbmaxsize100mbfilegrowth5mb
ametest1dat4file
amecdatat1dat4
dfsize5mbmaxsize100mbfilegrowth5mb
ftofilegrouptest1fg13)、从数据库中删除文件alterdatabasesampleremovefiletest1dat44)、更改文件alterdatabasesamplemodifyfile
ametest1dat3size20mb
1创建表createtablestude
tstidi
tst
amevarchar20streschar502删除表droptablestude
t3创建表时定义某列不能为空createtablestude
tstidi
t
ot
ullst
amevarchar20streschar504修改表的列altertablestude
t6altercolum
stidchar8
ot
ull5给表添加一列altertablestude
t6addstphi
t6删除表的一列altertablestude
t6dropcolum
stph7表的某列的重命名
fexecsp_re
amestude
t6stid
ewstidcolum
8表的重命名execsp_re
amestude
t6
ewstude
t6object9数据库的重命名方法1sp_re
amedbolddb
ame
ewdb
ame方法2sp_re
ameolddb
ame
ewdb
ameobject10查看系统数据类型select
ametypeFromsystypesOrderbytype
fr
好听全球资料 返回顶部