很实用的sql语句
--DLC指导学习
--打开cmdshell外围应用程序
exec sp_configure 'show advanced options',1
go
reconfigure
go
exec sp_configure 'xp_cmdshell',1
go
reconfigure
go
--用dos命令在D盘创建project文件夹
exec xp_cmdshell 'mkdir D:project'
go
--创建数据库stuDB
use master
go
set nocount on
if exists (select * from sysdatabases where [name]='stuDB')
drop database stuDB
create database stuDB
on
(name='stuDB_data',
filename='D:\project\stuDB_data.mdf',
size=5mb,
maxsize=100mb,
filegrowth=15%
)
log on
(name='stuDB_log',
filename='D:\project\stuDB_log.ldf',
size=2mb,
filegrowth=1mb
)
go
--创建学员信息表stuInfo
use stuDB
go
if exists (select * from sysobjects where [name]='tbl_stuInfo')
drop table tbl_stuInfo
create table tbl_stuInfo
(
stuName varchar(20) not null,
stuNo char(6) not null,
stuSex varchar(4) not null,
stuAge int not null,
--stuID numeric(18,0),
stuSeat smallint identity(1,1),
stuAddress text
)
go
--创建学员成绩表stuMarks
if exists (select * from sysobjects where [name]='tbl_stuMarks')
drop table tbl_stuMarks
create table tbl_stuMarks
(
ExamNo char(7) not null,
stuNo char(6) not null,
writtenExam int not null,
labExam int not null
)
go
--添加主键约束
alter table tbl_stuInfo add constraint PK_stuNo primary key (stuNo)
--添加唯一约束
--alter table tbl_stuInfo add constraint UQ_stuID unique (stuID)
--添加默认约束
alter table tbl_stuInfo add constraint DF_stuAddress default('地址不详')
for stuAddress
--添加检查约束
alter table tbl_stuInfo add constraint CK_stuAge check (stuAge between 15 and 40)
--添加外键约束
alter table tbl_stuMarks add constraint FK_stuNo foreign key (stuNo)
references tbl_stuInfo (stuNo)
go
--删除地址的默认约束
alter table tbl_stuInfo drop constraint DF_stuAddress
--向表stuInfo中插入数据
insert into tbl_stuInfo values('张秋丽','s25301','男',18,'北京海淀')
insert into tbl_stuInfo values('李文才','s25302','男',31,'地址不详')
insert into tbl_stuInfo values('李斯文','s25303','女',22,'河南洛阳')
insert into tbl_stuInfo values('欧阳俊雄','s25304','男',28,'新疆')
--向表stuMarks中插入数据
insert into tbl_stuMarks values('s271811','s25303',80,58)
insert into tbl_stuMarks values('s271813','s25302',50,90)
insert into tbl_stuMarks values('s271815','s25302',65,0)
insert into tbl_stuMarks values('s271816','s25301',77,82)
--判断是否存在数据库bbsDB--
use master
go
if exists (select * from sysdatabases where [name]='bbsDB')
drop database bbsDB
--创建数据库bbsDB--
create database bbsDB
on
(
name='bbsDB_data',
filename='D:\project\bbsDB_data.mdf',
size=10mb,
filegrowth=15%
)
log on
(
name='bbsDB_log',
filename='D:\project\bbsDB_log.ldf',
size=3mb,
maxsize=20mb,
filegrowth=15%
)
go
--判断是否存在表bbsUsers--
use bbsDB
go
if exists (select * from sysobjects where [name]='tbl_bb
美国DLC认证标_电子/电路_工程科技_专业资料。美国DLC认证标DesignLights Consortium ? Product Qualification Criteria, (FINAL 9/27/13) DLC 产品资格标准 ...
DLC涂层_机械/仪表_工程科技_专业资料。DLC涂层系列--DLC 涂层 类金刚石 涂层 涂层(类金刚石 类金刚石)涂层 酷 SP 及酷 SP+系列 系列 类金刚石涂层(...
DLC_工学_高等教育_教育专区。DLC载荷5.3 结构设计 5.3.1 概述 风力发电机组的结构设计应以承载零部件结构完整性的验证为基础。应通过计算和( 或)试验 验证...
Le88221DLC中文资料_电子/电路_工程科技_专业资料。元器件交易网www.cecb2b.com P R O D U C T P R E V I E W ? VE880 Series Dual Channel ...
元器件交易网www.cecb2b.com Technische Information / Technical Information IGBT-Module IGBT-Modules BSM 150 GB 170 DLC H?chstzul?ssige Werte / Maximum ...
BSM50GD120DLC中文资料_电子/电路_工程科技_专业资料。元器件交易网www.cecb2b.com Technische Information / Technical Information IGBT-Module IGBT-Modules BSM...
DLC安装说明_生活休闲。DLC安装说明 DLC安装说明一、DLCS.rar里面的DLC直接安装即可使用,方法如下: (1)解压DLCS.rar文件到磁盘上 (2)运行您的游戏安装目录下的...
元器件交易网www.cecb2b.com Technische Information / Technical Information IGBT-Module IGBT-Modules BSM 150 GB 60 DLC H?chstzul?ssige Werte / Maximum ...
DLC应用_工学_高等教育_教育专区。DLC薄膜的结构性能 - 组成、结构、性能 DLC薄膜的优点 - 特性、优点及比较 DLC薄膜的应用 -包装印刷、机械、光学、医学、电子...
暗黑3付费DLC的PVP内容?你想多了!_互联网_IT/计算机_专业资料。暗黑 3 付费 DLC 的 PVP 内容?你想多了! 近来网上消息四起,说是暴雪表示 PVP 将会作为...
热门文档