•例 • 创建一个规则,并绑定到表KC的课程号列,用于限制课
程号的输入范围 • use xscj • go • Create rule kc_rule • as @rang like ‘[1-5][0-9][0-9]’ • go • Use xscj • exec sp_bindrule ‘kc_rule’,’kc.kch’ • go
• use xscj
• create table xs3
• (xh char(6) not null constraint xh_pk primary key,
• xm char(8)not null,identtitycard char(20) constraint sh_uk unique,
• delete [from ]
•
{table_name׀view_name}
[where <search_condition>] •
的行删39Example:将XSCJ数据库的表XS中总学分小于 • 除:
USE XSCJ •
DELETE FROM XS •
39<
WHERE 总学分 •
go •
• 2. 使用TRUNCATE TABLE语句删除表 数据
• select xh,xm,zhy
• from xs1
•
Where zhy=‘生工’
• 查询结果:select * from xs2
• 二、使用DELETE或TRUNCAT删除数据
• delete 语句的功能是从表中删除行,其基本语法格式为:
• 二、 实体完整性的实现 • 通过选择一列或多列做主键可实现表的实体完整性。 • 一个表只能有一个primary key约束,且primary key