Как добавить ограничение к StaffPhone
- оно должно быть от 5 до 15 символов:
CREATE TABLE MsStaff
(
StaffID CHAR(5) NOT NULL PRIMARY KEY,
StaffName VARCHAR(50) NOT NULL,
StaffGender VARCHAR(6) NOT NULL,
StaffEmail VARCHAR(50) NOT NULL,
StaffPhone VARCHAR(15) NOT NULL,
StaffAddress VARCHAR(100) NOT NULL,
StaffSalary VARCHAR(100) NOT NULL,
CONSTRAINT StaffIDRule CHECK(StaffID LIKE 'ST[0-9][0-9][0-9]'),
CONSTRAINT StaffPhoneRule CHECK (LEN(StaffPhone) >= 5),
CONSTRAINT StaffGenderRule CHECK (StaffGender IN ('Male','Female')),
)