码迷,mamicode.com
首页 > 数据库 > 详细

sql基本语句

时间:2015-10-12 00:23:32      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:

自增长 增加时不需要对其设置值
仅当使用了列列表并且 IDENTITY_INSERT 为 ON 时,才能为表‘nrc_type‘中的标识列指定显式值。
insert into nrc_type(t_name,t_memo) values(‘111‘,‘222‘);
update nrc_type set t_name=‘222‘ where t_memo=‘222‘;
delete from nrc_type where t_memo=‘222‘;

创建表:
create table products
(
prod_id char(10) not null,
vend_id char(10) not null,
prod_name char(254) not null,
pro_price decimal(8,2) not null,
pro_desc varchar(1000) null
)

create table orders
(
order_num integer not null,
order_date datetime not null,
cust_id char(10) not null
)

create table vendors
(
vend_id char(10) not null,
vend_name char(50) not null,
vend_address char(50) ,
vend_city char(50) ,
vend_state char(50) ,
vend_zip char(50) ,
vend_country char(50)
)

create table orderitems
(
order_num integer not null,
order_item integer not null,
prod_id char(10) not null,
quantity integer not null default 1,
item_price decimal(8,2) not null
)

alter table vendors
add vend_phone char(20);

alter table vendors
drop column vend_phone;

drop table custcopy;

 

sql基本语句

标签:

原文地址:http://www.cnblogs.com/daochong/p/4870360.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!