码迷,mamicode.com
首页 > 数据库 > 详细

数据库20170907

时间:2017-09-07 12:01:02      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:ref   def   const   fit   arc   arch   birt   name   employee   

GO
create table Department(
Dep_Id CHAR(3) constraint PK_Dep_Id primary key not null,
Depname VarChar(40) not null,
Telephone char(16) null,
Fax char(16) null
)
GO
GO
create table Employee(
Emp_ID Char(6) constraint PK_Emp_Id primary key,
Empname Varchar(10) constraint NU_Empname not null,
Sex char(2) constraint CK_Sex check(Sex =‘男‘ or Sex =‘女‘),
Birthday DATE,
Dep_Id char(3) references Department (Dep_Id),
Prof varchar(10),
Phone varchar (20),
Email varchar(20),
Onjob BIT constraint DF_Onjob default 1
)
GO
GO
create table Salary(
Emp_Id char(6) references Employee(Emp_Id),
Month char(6),
Base decimal(10,2),
Bonus decimal(10,2),
Benefit decimal(10,2),
Yfgz AS (Base+Bonus+Benefit)PERSISTED,
Insurance decimal(10,2),
Tax decimal(10,2),
Sfgz as (Base+Bonus+Benefit-Insurance-Tax)PERSISTED,
primary key(Emp_Id,Month)
)
GO
select * from Department

数据库20170907

标签:ref   def   const   fit   arc   arch   birt   name   employee   

原文地址:http://www.cnblogs.com/ysxxxttt/p/7488619.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!