Time Left - 15:00 mins

GATE CS 2021 : Database Quiz 4 (App update required to attempt this test)

Attempt now to get your rank among 667 students!

Question 1

Consider the following statements:

Query 1: Select * from R

Query 2: (Select * from R) INTERSECT (Select * from R)

Query 3: Select Distinct * from R

What is the number of statements that produce the same output? 

Question 2

Consider the following query:

SELECT FROM WORKER WHERE WORKER_ID <= (SELECT count(WORKER_ID)/2 from Worker);

What is the correct meaning of the given SQL Query?

Question 3

Consider the following query:

SELECT * FROM Worker WHERE WORKER_ID <=5

UNION

SELECT * FROM (SELECT * FROM Worker W order by W.WORKER_ID DESC. AS W1 WHERE W1.WORKER_ID <=5;

What is the correct meaning of the SQL Query?

Question 4

Consider a table A as:

And a SQL query SELECT Serial_number, SUM(Payable_amount) FROM A GROUP BY Group_id.
The value of SUM(payable_amount) having Group_id = 2 ?

Question 5

Consider the following relational schema. An employee can work in more than one department; the pct time field of the Works relation shows the percentage of time that a given employee works in a given department.
Emp (eid: integer, ename: string, age: integer, salary: real)
Works (eid: integer, did: integer, pct time: integer)
Dept (did: integer, dname: string, budget: real, managerid: integer)
Consider the following statements:
S1:
S2: SELECT ename, age
FROM Emp E, Works W, Dept D
WHERE E.eid== W.eid ˄ W.did== D .did ˄ D .dname= ‘hardware’ ˄ ‘Software’
S3: SELECT ename, age
FROM Emp E, Works W, Dept D
WHERE E.eid== W.eid ˄ W.did== D .did ˄ D .dname= ‘hardware’
INTERSECTION
SELECT ename, age
FROM Emp E, Works W, Dept D
WHERE E .eid== W.eid ˄ W.did== D .did ˄ D .dname= ‘Software’

Which of the following will result into the “Name and ages of all the employeewho works in both the Hardware department and the Software department.”?

Question 6

Consider the following database table named top_scorer.

g2017_13

Consider the following SQL query:

SELECT ta.player FROM top_scorer AS ta
WHERE ta.goals > ALL ( SELECT tb.goals
		       FROM top_scorer AS tb
		       WHERE tb.country = 'Spain' )
      AND ta.goals > ANY (SELECT tc.goals
	       	        FROM top_scorer AS tc
		        WHERE tc.country = 'Germany')

The number of tuples returned by the above SQL query is ____

  • 667 attempts
  • 2 upvotes
  • 5 comments
Aug 10GATE & PSU CS