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
- Given below are two statements to find the sum of salaries of all employees of the English department as well as the maximum, minimum and a…
- Which of the following query/queries return the employee ID and name of employees whose salary is greater than the salary of all employees…
- In reference to the above given table structures, which of the following query/queries will drop the 'SALARY' column from 'EMPLOYEE' table?…
- Refer table, structures given above. The university decided to give all employees in the 'SCIENCE' department a 20% rise in salary. Which o…
- Which of the component module of DBMS does rearrangement and possible ordering of operations, eliminate redundancy in query and use efficie…
- Given two tables R1(x,y) and R2(y,z) with 50 and 30 numbers of tuples respectively. Find the maximum number of tuples in the output of natu…