建表
来源:互联网 发布:淘宝众筹 淘宝怎么不管 编辑:程序博客网 时间:2024/05/01 18:08
代码
--建表use StudentManager--指定if exists (select *from sysobjects where name='tbl+student')--判断drop table tbl_student--有就删除之后创建,没有就创建create table tbl_student(id int identity (1,1)primary key,--自增变量从1开始增加每次加1,设为主键stu_number char(10)not null,--学号不许为空stu_name varchar(20)not null,--注意特例stu_age int,birthday datetime,class_id int references tbl_class(class_id)--第一个是表中的名字,第二个是class表中的class_id--创建外键)use StudentManager--指定if exists (select *from sysobjects where name='tbl_class')--判断drop table tbl_class--有就删除之后创建,没有就创建create table tbl_class(class_id int identity (1,1)primary key,--自增变量从1开始增加每次加1,设为主键stu_number char(10)not null,--学号不许为空class_name varchar(20)not null,create_time datetime)
运行图片
小结:--文件恢复上次写的查询语句
0 0
- 建表
- 建表
- 建表
- 建表
- 建表
- 建表
- 建表 sql
- mysql 建表
- SQL2005建表
- Oracle 建表
- Mysql建表
- PowerDesigner建表
- MySQL 建表
- db2 建表
- DB2建表
- SQL 建表
- MySQL 建表
- mysql建表
- 算法训练 输出米字形
- Apriori算法
- Merge Two Sorted Lists
- 马尔可夫模型的一步转移概率矩阵Java代码实现
- oracle数据库系列-Archivelog归档文件相关操作
- 建表
- Android6.1 开关机动画和Logo制作与修改
- 2012年第三届蓝桥杯C/C++程序设计本科B组省赛 方阵旋转(代码填空)
- Debian Stable (wheezy 7.8 )升级到最新的stable (Jessie 8.0)
- druid简单教程
- [李景山php]每天laravel[025]-laravel 基础知识 --- 中间件
- 取消鼠标右键默认事件contextmenu
- April Fools Contest 2017 E. Twisted Circuit
- 取消鼠标右键默认事件contextmenu