Question: CREATE TABLE Company ( person _ id int PRIMARY KEY, person _ Name VARCHAR ( 2 5 5 ) , department _ ID VARCHAR (

CREATE TABLE Company (
person_id int PRIMARY KEY,
person_Name VARCHAR(255),
department_ID VARCHAR(255),
company_Name VARCHAR(255),
isAstMgr BOOLEAN,
isMgr BOOLEAN,
isGnrMgr BOOLEAN,
FOREIGN KEY (deparment_ID,company_Name) REFERENCES Holding(deparment_ID,company_Name)
);
How to check condition that a person can only have one role which is AstMgr or Mgr or GnrMgr. Two or more roles are not possible per person.
There may be several AstMgr or Mgr for a specific (deparment_ID,company_Name).
If there is a GnrMgr for a specific (deparment_ID,company_Name) there will not be other GnrMgr for same company.
How to write a DDL to check isGnrMgr column and not to allow to enter second GnrMgr for the same unique (deparment_ID,company_Name)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!