UGC NET CS 2020Database Management Systems › SQLVerified
UGC NET CS 2020 PYQ: Consider the following table structures related to a university for the below question. EMPLOYEE NAME…
Consider the following table structures related to a university for the below question.
EMPLOYEE
NAME VARCHAR (30) NOT NULL,
EID VARCHAR (10) NOT NULL,
DEPTNO INT (5) NOT NULL,
HODEID VARCHAR (10),
SALARY INT (10),
PRIMARY KEY (EID),
FOREIGN KEY (HODEID) REFERENCES EMPLOYEE (EID),
FOREIGN KEY (DEPTNO) REFERENCES DEPARTMENT (DID); DEPARTMENT
DID INT (5) NOT NULL,
DNAME VARCHAR(30) NOT NULL,
HODID VARCHAR (10) NOT NULL,
HODNAME VARCHAR (30),
PRIMARY KEY (DID),
UNIQUE (DNAME),
FOREIGN KEY (HODID) REFERENCES EMPLOYEE (EID) PROJECT WORK:
EMPID VARCHAR (10) NOTNULL,
PROJNO INT(5) NOT NULL,
PROJECTLOC VARCHAR (30) NOT NULL,
PRIMARY KEY (EMPID, PROJNO),
FOREIGN KEY (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:
- ABoth Statement $I$ and Statement $II$ are true
- BBoth Statement $I$ and Statement $II$ are false
- CStatement $I$ is correct but Statement $II$ is falseCorrect answer
- DStatement $I$ is incorrect but Statement $II$ is true
Answer
(C) Statement $I$ is correct but Statement $II$ is false
Approach
Check each statement for correct join condition and valid aggregate syntax, then compare with the given options.
Reviewed by UGC IQ Editorial Team.