check约束,在线等待

来源:百度知道 编辑:UC知道 时间:2024/06/03 10:40:02
create table employee
(
emp_no char(5) ,
emp_name char(10) not null,
sex char(1) not null
primary key(emp_no)
)
在表employee加入CHECK约束:输入的员工编号必须以E开头的5位数编号,性别只能为M/F。我不知道如何实现,希望高手帮帮忙!在线等待

create table employee
(
emp_no char(5) check(emp LIKE 'E%' AND LEN(emp_no)=5),
emp_name char(10) not null,
sex char(1) not null check(sex IN(M,F))
primary key(emp_no)
)
-------------
我也不是很清楚,不能保证对。你看看,也许会受点启发。