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)).

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 average salary in English department. STATEMENT I : SELECT SUM (SALARY), MAX (SALARY), MIN (SALARY), AVG (SALARY) FROM EMPLOYEE, DEPARTMENT WHERE DEPTNO=DID AND DNAME='ENGLISH'; STATEMENT II: SELECT SUM (SALARY), MAX (SALARY), MIN (SALARY), AVG (SALARY) FROM EMPLOYEE, DEPARTMENT WHERE DNAME='ENGLISH'; In the light of the above statements, choose the correct answer from the options given below

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

Show answer & explanation

Correct answer: C. Statement I is correct but Statement II is false

Explanation

Statement I joins EMPLOYEE to DEPARTMENT on DEPTNO = DID and filters on English. Statement II omits the join condition, so it aggregates over a Cartesian product and counts every employee.

More Database Management Systems questions