Aspire Faculty ID #19006 · Topic: UGC NET Computer Science Nov 2020 (Paper II) · Just now
UGC NET Computer Science Nov 2020 (Paper II)

Consider the following table structures related to a university for the below questions. 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) NOT NULL
PROJNO INT(5) NOT NULL
PROJECTLOC VARCHAR(30) NOT NULL
PRIMARY KEY (EMPID, PROJNO), FOREIGN KEY (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$.

Solution

We need to retrieve distinct employee IDs.

So, we must use:

SELECT DISTINCT EMPID

Now, the project number can be $20$, $30$ or $40$.

For checking multiple possible values in SQL, we use IN operator.

So, correct condition is:

WHERE PROJNO IN (20,30,40)

Therefore, correct SQL query is:

SELECT DISTINCT EMPID
FROM PROJECTWORK
WHERE PROJNO IN (20,30,40);

Option (A) is incorrect because PROJNO=(20,30,40) is not valid SQL syntax.

Option (B) is incorrect because it does not use DISTINCT.

Option (D) is incorrect because PROJNO=20,30,40 is not valid SQL syntax.

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

Previous 10 Questions — UGC NET Computer Science Nov 2020 (Paper II)

Nearest first
1
concern a disk with a sector size of $512$ bytes, $2000$ tracks per surface, $50$ sectors per track, five double-sided …
Topic: UGC NET Computer Science Nov 2020 (Paper II)
2
concern a disk with a sector size of $512$ bytes, $2000$ tracks per surface, $50$ sectors per track, five double-sided …
Topic: UGC NET Computer Science Nov 2020 (Paper II)
3
concern a disk with a sector size of $512$ bytes, $2000$ tracks per surface, $50$ sectors per track, five double-sided …
Topic: UGC NET Computer Science Nov 2020 (Paper II)
4
concern a disk with a sector size of $512$ bytes, $2000$ tracks per surface, $50$ sectors per track, five double-sided …
Topic: UGC NET Computer Science Nov 2020 (Paper II)
5
concern a disk with a sector size of $512$ bytes, $2000$ tracks per surface, $50$ sectors per track, five double-sided …
Topic: UGC NET Computer Science Nov 2020 (Paper II)
6
Given below are two statements:Statement I: A genetic algorithm is a stochastic hill-climbing search in which a large p…
Topic: UGC NET Computer Science Nov 2020 (Paper II)
7
Given below are two statements:Statement I: In Caesar Cipher each letter of Plain text is replaced by another letter fo…
Topic: UGC NET Computer Science Nov 2020 (Paper II)
8
Given below are two statements:Statement I: The laws of nature put two fundamental limits on the data rate of a channel…
Topic: UGC NET Computer Science Nov 2020 (Paper II)
9
Given below are two statements:Statement I: The problem "Is $L_1\cap L_2=\phi$?" is undecidable for context sensitive l…
Topic: UGC NET Computer Science Nov 2020 (Paper II)
10
Let $G$ be a simple undirected graph, $T_D$ be a DFS tree on $G$, and $T_B$ be the BFS tree on $G$.Consider the followi…
Topic: UGC NET Computer Science Nov 2020 (Paper II)

Next 10 Questions — UGC NET Computer Science Nov 2020 (Paper II)

Ascending by ID
Ask Your Question or Put Your Review.

loading...