Sql 总结1.数据模型重要有:层次模型,网状模型,关系模型,2.数据库设计的环节:需求分析,概念构造设计,逻辑构造设计,数据库物理设计,数据库实行,数据库运行和维护六个阶段。3.实体之间的关系:一对一、一对多、多对多。4.数据库文献重要有:主数据文献、次数据文献、日志文献其中次数据文献是可选的。--这是建库的过程if exists(select*from sysdatabases where name='tt'drop database ttcreate database tton(name=tt,filename='d:\data\tt.mdf',size=4mb,maxsize=50mb,filegrowth=15%log on(name=tt1,filename='d:\data\tt1.ldf',size=5mb,maxsize=79mb,filegrowth=15%--这是对数据库的修改alter database ttmodify file(name=tt1,maxsize=89mb--增长日志文献alter database ttadd log file(name=oo,filename='d:\data\oo.ldf',size=5mb,maxsize=79mb,filegrowth=15%----查看数据库sp_helpdb tt5.重要的数据类型Int float char(size datetime varchar(size 6.在数据库中添加表use ttgoif exists(select*from sysobjects where name='t_li' drop table t_licreate table t_li(a char(4not null,b int not null,c datetimeinsert into t_li values('yy',78,-5-12insert into t_li (a,bvalues('ttf',89select*from t_li--新建一种表,往表里添加 t_li 的数据create table t_ti1(a char(4not null,b int not nullinsert into t_ti1select a,b from t_li---这种措施不用重建select a,binto t_li2from t_liselect*from t_li26.使用 union 关键字插入多行数据---运用 union 一次插入多行数据insert into t_li (a,b,cselect'aa',55,-8-12 unionselect'cc',54,2032-5-127.对数据表进行操作---对表的修改alter table t_lialter column a char(8select*from t_li--添加字段alter table t_liadd d char(9--删除字段alter table t_lidrop column d--表的查询select*from t_li8.对字段添加约束---添加主键约束应当注意是主键约束字段的值不能是反复的alter table t_liadd constraint pk_a primary key(a---添加外键约束alter table t_liadd constraint fr_b foreign key(breferences t_li4(b--添加唯一约束alter table t_liadd constraint t_li_uq unique(a---添加默认约束alter table t_liadd constraint t_li_df default(20for b--添加 check ...