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
- 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…
- Given two tables EMPLOYEE (EID, ENAME, DEPTNO) DEPARTMENT (DEPTNO, DEPTNAME) Find the most appropriate statement of the given query : Selec…