ry key (userID)
)
go
if object_id('mdbo')is not null
drop table mdbo
create table mdbo
(manaID char(20) not null,
mpassword char(20)not null,
primary key (manaID)
)
go
insert into mdbo values ('mana1','1')
insert into mdbo values ('mana2','2')
go
if object_id('news')is not null
drop table news
create table news
(titlesID smalldatetime default day(getdate()),
titles varchar(50) not null,
contents varchar(1500))
go
if object_id('chat') is not null
drop table chat
create table chat
(chatID int IDENTITY(1,1),
chatname char(20),
chattitle varchar(50),
chatcontent varchar(1000))
go
create unique clustered index chat_ind
on chat(chatID)
go
---------------------表的修改----触发器----约束-----列
--------添加例
------alter table table_name
----------alter column 列名 类型(值)----------修改指定列
----------DROP {[CONSTRAINT]约束名|COLUMN 列名} []------删除约束或列
----------add 列名 类型(值) ..-----添加新例
----------add check (列名 in ())---添加新的例约束
----------{CHECK|NOCHECK}CONSTRAINT{ALL|约束名|}--使所有约束或指定约束---有效/无效
----------{ENABLE|DISABLE}TRIGGER{ALL|触发器名|}--使所有触发器或指定触发器---有效/无效
------------------------------------------------------------------索引
--创建
--create [unique][clustered|nonclustered] index 索引名 on 表名(列名[,.])
-------创建唯一索引---簇集索引|非簇集索引---
--删除索引
--drop index '表名.索引名'[,.]
-------------select 查寻
-----select [DISTINCT] [ALL] [TOP integer|TOP interger PERCENT] 列名 [,n]
-----------过滤重复数据--全部显示---返回最前面的integer行----用百分数表示的行
----from 表名
--********-like 模糊查询******************************************************************like 模糊查询***
----列名 like "查询条件(%,_,[],[^]内的条件)" [escape "t"]
------------------注意使用通配符---------------转意字符t后面的任意第一个通