zoukankan      html  css  js  c++  java
  • 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为自动计算字段,不能输入值--
    )
  • 相关阅读:
    Codeforces Round #631 (Div. 1) B. Dreamoon Likes Sequences 题解(思维+求贡献)
    牛客练习赛66 C公因子 题解(区间gcd)
    evincevim控喜欢的pdf阅读器
    水手郑智化
    使用diskpart管理自己的分区
    Hacker's Browser
    How Browser Works
    解决vim ctags R失败的问题
    ubuntu更改登录对话框
    使用bcdedit删除多个Windows系统
  • 原文地址:https://www.cnblogs.com/edisonfeng/p/2171333.html
Copyright © 2011-2022 走看看