SqlServer常用的数据类型 1.数值型 int 整数 float 小数 2.字符型 char(n) 定长字符串 varchar(n) 可变长字符串 3.日期型 datetime 约束语法 1.主键约束PK primary key 唯一且非空,保证实体完整性,每一行都是唯一的 联和主键,组合唯一且非空 追加约束DDL:alter alter table 表名; add constraint XXXX primary key(); 删除约束 alter table 表名; drop constraint XXXX 2.唯一约束UK unique 保证实体完整性 3.外键约束FK foreign key foreign key(字段名) references 表(字段) 4.非空约束NN not null 分类 1.DDL数据定义语言 create 创建 database table index view drop 删除 database table index view constraint alter 改变 2.DML数据操纵语言 insert 增加 delete 删除 update 修改 select 查询 DQL数据库查询语言 语法: select from 表1,表2,... where 查询条件组合and, or, not, =, >, <, >=, <=, between and, in, is null,is not null, like '%_[]' group by 分组字段 having 分组后的过滤条件 order by 排序字段和规则 3.TCL事务控制语言transaction begin transaction; ... commit; rollback;