1.数据库和表的创建

数据库的创建

create database YGGL2
on(
name="YGGL2",
filename="C:\Program Files\Microsoft SQL Server\MSSQL11.WANGXUELIANG\MSSQL\DATA\YGGL2.mdf",
size=10mb,
maxsize=50mb,
filegrowth=5%
)
log on(
name="YGGL_log2",
filename="C:\Program Files\Microsoft SQL Server\MSSQL11.WANGXUELIANG\MSSQL\DATA\YGGL_log2.ldf",
size=2mb,
maxsize=5mb,
filegrowth=1mb
)

表的创建

create table Employees
(
EmpID char(6) not null primary key,
EmpName char(10) not null,
EmpEdu char(4) not null,
EmpBir date not null,
EmpSex bit not null default 0,
WorkYear tinyint,
Addres varchar(40),
PhoneNum char(12),
DepID char(3) not null
)

--创建部门表
create table  Departments
(
DepID char(3) not null primary key,
DepName char(20) not null,
Note varchar(100),
)

--创建工资表
create table  Salary
(
EmpID char(6) not null primary key,
InCome float not null,
OntCome float not null
)

临时表的创建

--创建临时表
create table #temp
(
EmpID int not null primary key,
EmpAdd varchar(20)
)


posted @ 2018-02-05 18:13  王雪亮  阅读(133)  评论(0编辑  收藏  举报