zoukankan      html  css  js  c++  java
  • sql server数据建表

    use edudb
    go
    if exists(select * from sysobjects where name='department')
    drop table department
    create table department(
      id int identity(1,1) primary key,
      name varchar(20) not null,
      user_id int not null,
      user_name varchar(20) null,
      note text null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='departmember')
    drop table departmember
    create table departmember(
      id int identity(1,1) primary key,
      department_id int not null,
      user_id int not null,
      user_name varchar(20) null,
      role int null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='division')
    drop table division
    create table division(
      id int identity(1,1) primary key,
      name varchar(20) not null,
      user_id int not null,
      user_name varchar(20) null,
      note text null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='divisionmember')
    drop table divisionmember
    create table divisionmember(
      id int identity(1,1) primary key,
      division_id int not null,
      user_id int not null,
      user_name varchar(20) null,
      role int null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='class')
    drop table class
    create table class(
      id int identity(1,1) primary key,
      name varchar(20) not null,
      grade int not null,
      master_id int null,
      master_name varchar(20) null,
      master_tel char(20) null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='user')
    drop table [user]
    create table [user](
      id int identity(1,1) primary key,
      name varchar(20) not null,
      birth decimal(17,6) not null,
      avatar varchar(100) null,
      auth_id int null,
      nick varchar(50) not null,
      pwd varchar(50) not null,
      lastlogin decimal(17,6) not null,
      lastip char(20) not null,
      addtime decimal(17,6) not null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='auth')
    drop table [auth]
    create table [auth](
      id int identity(1,1) primary key,
      name varchar(20) not null,
      code varchar(100) null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='teacher')
    drop table [teacher]
    create table [teacher](
      id int identity(1,1) primary key,
      user_id int not null,
      realname char(20) not null,
      workno char(20) not null,
      avatar varchar(100) null,
      certype int not null,
      cerno varchar(50) not null,
      sex tinyint not null,
      birth decimal(17,6) not null,
      status int not null,
      nation char(20) not null,
      domicile char(20) not null,
      birthloca varchar(100) not null,
      speciality char(20) not null,
      degree char(20) not null,
      graduatetime decimal(17,6) not null,
      graduateschool varchar(100) not null,
      langtype tinyint not null,
      langlevel tinyint not null,
      worklevel tinyint not null,
      chineselevel tinyint not null,
      proftype tinyint not null,
      party char(20) not null,
      partytime decimal(17,6) not null,
      curhow varchar(50) not null,
      curway varchar(50) not null,
      curtime decimal(17,6) not null,
      worktime decimal(17,6) not null,
      enroltime decimal(17,6) not null,
      flag1 tinyint not null,
      flag2 tinyint not null,
      flag3 tinyint not null,
      flag4 tinyint not null,
      flag5 tinyint not null,
      teachtime decimal(17,6) not null,
      retiretime decimal(17,6) not null,
      level tinyint not null,
      positionlevel tinyint not null,
      managetype tinyint not null,
      position char(20) not null,
      type1 int not null,
      type2 int not null,
      appleid char(50) not null,
      address varchar(100) not null,
      tel varchar(50) not null,
      mobile varchar(50) not null,
      qq char(20) null,
      email varchar(50) not null,
      bank1 varchar(50) not null,
      bank1no varchar(50) not null,
      bank2 varchar(50) not null,
      bank2no varchar(50) not null,
      healthcard varchar(50) not null,
      division_id int not null,
      division_name varchar(50) not null,
      department_id int not null,
      department_name varchar(50) not null
    )
    go


    if exists(select * from sysobjects where name='semester')
    drop table [semester]
    create table [semester](
      id int identity(1,1) primary key,
      startime decimal(17,6) not null,
      endtime decimal(17,6) not null,
      name varchar(20) null,
      year char(20) null,
      ord int null,
      status int null
    )
    go

    if exists(select * from sysobjects where name='course')
    drop table [course]
    create table [course](
      id int identity(1,1) primary key,
      name varchar(20) not null,
      belong int not null,
      score tinyint not null,
      max char(20) null,
      min char(20) null,
      status int null
    )
    go

    这里用到了创建数据表,删除数据表,字段类型等知识

  • 相关阅读:
    MediaInfo代码阅读
    HEVC与VP9之间的对比
    x264阅读记录-3
    x264阅读记录-2
    x264阅读记录-1
    Linux脚本程序
    VS2015 ASP.NET5 Web项目结构浅析
    VS2015 Apache Cordova第一个Android和IOS应用
    VS2015 C#6.0 中的那些新特性
    aehyok.com的成长之路三——框架结构
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/3380655.html
Copyright © 2011-2022 走看看