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
这里用到了创建数据表,删除数据表,字段类型等知识
sql server数据建表的更多相关文章
- SQL SERVER 生成建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_MSSQL] Script Date: 06/15/2012 11:59:00 ***** ...
- (转)SQL SERVER 生成建表脚本
https://www.cnblogs.com/champaign/p/3492510.html /****** Object: StoredProcedure [dbo].[GET_TableScr ...
- 在SQL SERVER中获取表中的第二条数据
在SQL SERVER中获取表中的第二条数据, 思路:先根据时间逆排序取出前2条数据作为一个临时表,再按顺时排序在临时表中取出第一条数据 sql语句如下: select top 1 * from(se ...
- 快速查看SQL Server 中各表的数据量以及占用空间大小
快速查看SQL Server 中各表的数据量以及占用空间大小. CREATE TABLE #T (NAME nvarchar(100),ROWS char(20),reserved varchar(1 ...
- [SQL]SQL Server数据表的基础知识与增查删改
SQL Server数据表的基础知识与增查删改 由张晨辉(学生) 于19天 前发表 | 阅读94次 一.常用数据类型 .整型:bigint.int.smallint.tinyint .小数:decim ...
- 使用Spark加载数据到SQL Server列存储表
原文地址https://devblogs.microsoft.com/azure-sql/partitioning-on-spark-fast-loading-clustered-columnstor ...
- SQL Server数据表设计编辑后无法保存处理办法
关于使用 SQL Server 企业管理器,表[设计]界面,修改数据表字段或类型无法保存的问题处理过程: 使用SQL Server数据库的你是否遇到过每次数据库编辑工具内点击设计修改表字段或类型要保存 ...
- SQL SERVER数据库的表中修改字段的数据类型后,不能保存
在数据库里面建了一个表,可是由于对SQL SERVER的建表功能不熟悉,不知道把主键设成什么是好,就先设置了个TEXT类型,可是后来朋友们告诉我说,TEXT类型容易让数据文件变得很大,还 是改成一 ...
- MS SQL SERVER搜索某个表的主键所在的列名
原文:MS SQL SERVER搜索某个表的主键所在的列名 SELECT SYSCOLUMNS.name FROM SYSCOLUMNS,SYSOBJECTS,SYSINDEXES,SYSINDEX ...
随机推荐
- mysql常用查询归纳
一.mysql查询的五种子句 where(条件查询).having(筛选).group by(分组).order by(排序).limit(限制结果数) .where常用运算符: 比较运算符 > ...
- SQL语言的组成
在正式学习SQL语言之前,首先让我们对SQL语言有一个基本认识,介绍一下SQL语言的 组成: 1.一个SQL数据库是表(Table)的集合,它由一个或多个SQL模式定义. 2.一个SQL表由行集构成, ...
- 简单计算器(Android)
aaarticlea/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKC
- puppet foreman
服务器(物理机器和虚拟机)多了以后需要工具来管理,经常登陆系统后不知是在虚拟机上还是在物理机上?如果在虚拟机上这个虚拟机运行在哪个服务器节 点(host)上?如果在物理机上运行在什么配置的物理机上?运 ...
- [Oracle] 使用触发器实现IP限制用户登录
在Oracle里,不像MySQL那样方便,可以直接在用户上进行IP限制,Oracle要实现用户级别的IP限制,可以使用触发器来迂回实现,下面是一个触发器的例子: create or replace t ...
- unity3d 学习笔记(一)
操作:按下shit 点击坐标轴中心 切换透视图 动画烘焙的概念:相当于把原来的控制器动画或者IK(骨骼)动画所有塌陷为逐帧动画,导出的时候必须选这一项 着色器:从技术的角度来看,着色器是渲染器的一个部 ...
- hadoop集群监控工具ambari安装
Apache Ambari是对Hadoop进行监控.管理和生命周期管理的基于网页的开源项目.它也是一个为Hortonworks数据平台选择管理组建的项目.Ambari支持管理的服务有: Apache ...
- jsp filter登录限制过滤器
http://www.cnblogs.com/hemingwang0902/archive/2012/01/09/2316956.html UserFilter.java package filter ...
- 图像重采样(CPU和GPU)
1 前言 之前在写影像融合算法的时候,免不了要实现将多光谱影像重采样到全色大小.当时为了不影响融合算法整体开发进度,其中重采样功能用的是GDAL开源库中的Warp接口实现的. 后来发现GDAL War ...
- Cortex-A9 PWM Timer
PWM定时器 4412时钟为我们提供了PWM定时器,在4412中共有5个32位的定时器,这些定时器可发送中断信号给ARM子系统.另外,定时器0.1.2.3包含了脉冲宽度调制(PWM),并 ...