资源预览内容
第1页 / 共10页
第2页 / 共10页
第3页 / 共10页
第4页 / 共10页
第5页 / 共10页
第6页 / 共10页
第7页 / 共10页
第8页 / 共10页
第9页 / 共10页
第10页 / 共10页
亲,该文档总共10页全部预览完了,如果喜欢就下载吧!
资源描述
第2章 数据定义 2.6 数据定义SQL语言方式 2.6.3 数据表操作数据完整性约束,(下集),2.6 数据定义SQL语言方式,2.6.1 体验SQL 2.6.2 数据库操作 2.6.3 数据表操作 1 创建表 2 数据完整性约束 3 变更表 4 丢弃(删除)表 2.6.4 索引操作,非空约束,- 方式一:列级非空约束 Create table tbl_class1 ( id_tbl_class int not null primary key identity, col_name varchar(50) NOT NULL unique - 非空约束 );,- 方式二:用Alter语句变更表结构 -下一节课讲解,非空约束,检查约束,- 方式一:列级检查约束 Create table tbl_score1 ( id_tbl_score int not null primary key identity, col_score int null CHECK (col_score=0 and col_score=100), - 列级检查约束 );,- 方式二:表级检查约束 Create table tbl_score1 ( id_tbl_score int not null primary key identity, col_score int null, , CONSTRAINT chk_score CHECK (col_score=0 and col_score=100) - 表级检查约束 );,- 方式三:用Alter语句变更表结构 -下一节课讲解,检查约束,默认约束,- 方式一:列级默认约束 Create table tbl_course1 ( id_tbl_course int not null primary key identity, col_name varchar(50) not null unique, col_hours int null DEFAULT 64, - 列级默认约束 id_tbl_faculty int not null references tbl_faculty (id_tbl_faculty) );,- 方式二:用Alter语句变更表结构 -下一节课讲解,默认约束,2.6 数据定义SQL语言方式,2.6.1 体验SQL 2.6.2 数据库操作 2.6.3 数据表操作 1 创建表 2 数据完整性约束 3 变更表 4 丢弃(删除)表 2.6.4 索引操作,
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号