Below the primary key of the employee table in the working status of the primary key of the former two tables for the department department, so gonghaowu constraint conditions of how to write?? Hope leaders can answer
CodePudding user response:
CodePudding user response:
The pictures looked at you, help you make is, Staff table should increase a field: department, to match the regular table design principle, Added the department number field, the working field constraint is simple:
- 1. Increase the number of the department The ALTER TABLE ygb ADD BMH NCHAR (2) GO - 2. Increase the check constraint The ALTER TABLE ygb ADD CONSTRAINT CK_ygb_gh CHECK (LEFT (gh, 2)=BMH)