Day 5(11.7):(5)练习
来源:互联网 发布:excel会计记账软件 编辑:程序博客网 时间:2024/06/05 18:24
--创建叫号单表(有序号、欢迎词、系统时间)
int identity(1,1)
select getdate()
1 Welcome 2015-11-07 11:05:19.750
2 Welcome 2015-11-07 11:05:20.267
3 Welcome 2015-11-07 11:05:20.470
4 Welcome 2015-11-07 11:05:20.657
5 Welcome 2015-11-07 11:05:20.847
6 Welcome 2015-11-07 11:05:21.063
create table jiaohao
(
number int identity(1,1),
c_wel varchar(10),
c_time datetime default(getdate())
)
insert jiaohao(c_wel) values ('welcome')
select * from jiaohao
--创建主键表product1
Create table product1(productID varchar(10) primary key, productName varchar(30), unitprice float)
--要求:创建orders1的同时创建外键
--创建订单表orders1,包含3个字段:orderID(订单号)为varchar类型,长度为20,不允许为空; pID(产品代码)为varchar类型,长度为10;qty(数量)为int型.
--在orders表的pID字段增加外键约束,参照product表的productID字段
create table orders2
(
orderID varchar(20) not null,
pID varchar(10),
qty int,
foreign key (pID)references product1(productID)
)
int identity(1,1)
select getdate()
1 Welcome 2015-11-07 11:05:19.750
2 Welcome 2015-11-07 11:05:20.267
3 Welcome 2015-11-07 11:05:20.470
4 Welcome 2015-11-07 11:05:20.657
5 Welcome 2015-11-07 11:05:20.847
6 Welcome 2015-11-07 11:05:21.063
create table jiaohao
(
number int identity(1,1),
c_wel varchar(10),
c_time datetime default(getdate())
)
insert jiaohao(c_wel) values ('welcome')
select * from jiaohao
--创建主键表product1
Create table product1(productID varchar(10) primary key, productName varchar(30), unitprice float)
--要求:创建orders1的同时创建外键
--创建订单表orders1,包含3个字段:orderID(订单号)为varchar类型,长度为20,不允许为空; pID(产品代码)为varchar类型,长度为10;qty(数量)为int型.
--在orders表的pID字段增加外键约束,参照product表的productID字段
create table orders2
(
orderID varchar(20) not null,
pID varchar(10),
qty int,
foreign key (pID)references product1(productID)
)
0 0
- Day 5(11.7):(5)练习
- Day 9:(5)简单查询练习参考答案
- Day 5 linux基础命令练习二
- Day 5(11.8):分组查询练习1答案
- 函数(Day-5)
- DAY 5
- Day 5
- day 5
- Day-5
- DAY 5
- Day 5
- [打字练习]Day One
- [打字练习]Day Two
- [打字练习]Day Five
- Day 5(11.7):(3)运算符
- 20day-、UI综合练习(网易彩票)---知识点储备
- 076day(文件读写和题目练习)
- 每天坚持Crack Code(Day 5)
- Shell 脚本学习
- Linux-grep命令小记
- 通过apt-get 安装java,JAVA_HOME 的路径
- Hello world!
- NYOJ71 独木舟上的旅行
- Day 5(11.7):(5)练习
- *LeetCode-Power of Two
- PostgreSQL中的数组与Any
- Struts2+Spring+Hibernate整合的例子
- c++在类的内部访问全局变量
- Bootstrap初级用户谈谈网页在手机上的显示效果优化
- C#编写NotifyIcon 将窗口最小化到托盘
- 开启Python
- [Python] Numpy学习笔记(二)