百里挑一陈赫娄艺潇,毛万春的老婆,易虎臣女友叶雪
新建表:
create table [表名]
(
[自动编号字段] int identity (1,1) primary key ,
[字段1] nvarchar(50) default '默认值' null ,
[字段2] ntext null ,
[字段3] datetime,
[字段4] money null ,
[字段5] int default 0,
[字段6] decimal (12,4) default 0,
[字段7] image null ,
)
删除表:
drop table [表名]
插入数据:
insert into [表名] (字段1,字段2) values (100,'51windows.net')
删除数据:
delete from [表名] where [字段名]>100
更新数据:
update [表名] set [字段1] = 200,[字段2] = '51windows.net' where [字段三] = 'haiwa'
新增字段:
alter table [表名] add [字段名] nvarchar (50) null
删除字段:
alter table [表名] drop column [字段名]
修改字段:
alter table [表名] alter column [字段名] nvarchar (50) null
重命名表:(access 重命名表,请参考文章:在access数据库中重命名表)
sp_rename '表名', '新表名', 'object'
新建约束:
alter table [表名] add constraint 约束名 check ([约束字段] <= '2000-1-1')
删除约束:
alter table [表名] drop constraint 约束名
新建默认值
alter table [表名] add constraint 默认值名 default '51windows.net' for [字段名]
删除默认值
alter table [表名] drop constraint 默认值名
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
-
sql某个日期是当年的第几周
/* *周一作为一周的开始 *当年的1月1号所在的周算作第一周 */ CREATE function GetWeekIndexFirstDate ( @...
[阅读全文]
-
-
数据库SQL---范式
1、数据冗余导致的问题:冗余存储、更新异常、插入异常、删除异常。 2、函数依赖:一种完整性约束。 在关系模式r(R)中,α属于R,β属于R。 1)α函数...
[阅读全文]
-
-
数据库SQL---查询
1、查询所有列 select *from emp;--*表示所有的,from emp表示从emp表中查询。 2、查询指定列 select empno,e...
[阅读全文]
-
-
-
-
网友评论