All mock tests are FREE till 31 December — register to save your progress
Unit 4 · Database Management Systems Paper 2 CS · November 2020

Directions (Q96–100): A university database has the tables EMPLOYEE (EID, NAME, SALARY, DEPTNO, HODEID …; PRIMARY KEY EID; HODEID references EMPLOYEE(EID); DEPTNO references DEPARTMENT(DID)), DEPARTMENT (DID, DNAME, HODID; PRIMARY KEY DID; UNIQUE DNAME; HODID references EMPLOYEE(EID)) and PROJECTWORK (EMPID, PROJNO; PRIMARY KEY (EMPID, PROJNO); EMPID references EMPLOYEE(EID)).

On the basis of above given table structures, retrieve the distinct employee ID (EMPID) of all employees of university who are working on project No.20, 30 and 40.

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. SELECT DISTINCT EMPID FROM PROJECTWORK WHERE PROJNO IN (20,30,40);

Explanation

PROJNO IN (20, 30, 40) matches any of the three projects, and DISTINCT removes an employee listed for several of them. A and D are not valid SQL.

More Database Management Systems questions