Sql Server创建表示例程序

    USE suntest  
create table 仓库
(
仓库编号
int ,
仓库号
varchar(50) ,
城市
varchar(50) ,
面积
int
)
create table 仓库1
(
仓库编号
int not null ,
仓库号
varchar(50) not null,
城市
varchar(50) not null, --不能为空not null--
面积 int
)
create table 仓库2
(
仓库编号
int primary key , --主键的关键字primary key--
仓库号 varchar(50) unique, --唯一索引关键字unique--
城市 varchar(50) not null, --不能为空not null--
面积 int
)
create table 仓库3
(
仓库编号
int primary key , --主键的关键字primary key--
仓库号 varchar(50) unique, --唯一索引关键字unique--
城市 varchar(50) default '青岛', --不能为空not null--
面积 int check (面积>=300 and 面积<=1800)
)
create table 职工表
(
职工编号
int identity (1,1) primary key,
职工号
varchar(50) unique,
仓库号
varchar(50),
工资
int check(基本工资>=800 and 基本工资<=2100),
)
create table 订单表
(
订单编号
int identity(1,1) primary key,
订单号
varchar(50) unique,
职工号
varchar(50) references 职工表(职工号),--references两张表通过“职工号”关联--
订购日期 datetime,
销售金额
int
)
create table 阳光工资表
(
职工编号
int identity (1,1) primary key,
职工号
varchar(50) unique,
仓库号
varchar(50),
基本工资
int check(基本工资>=800 and 基本工资<=2100),
加班工资
int,
奖金
int,
扣率
int,
应发工资
as (基本工资+加班工资+奖金-扣率) --as为自动计算字段,不能输入值--
)

转载于:https://www.cnblogs.com/edisonfeng/archive/2011/09/08/2171333.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值