Time Left - 15:00 mins

SQL Starter Quiz-2

Attempt now to get your rank among 76 students!

Question 1

Which SQL keyword is used to retrieve a maximum value?

Question 2

Consider the following relations:
Student (snum: integer, sname: string, major: string, level: string, age: integer)
Class (name: string, meets at: string, room: string, fid: integer)
Enrolled (snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
The meaning of these relations is straightforward; for example, Enrolled has one record per student-class pair such that the student is enrolled in the class.
Consider the following SQL statement:
S1: SELECT C.name
FROM Class C
WHERE C.room = ‘R128’
OR C.name IN
(SELECT E.cname , E.Snum
FROM Enrolled E
GROUP BY E.cname
HAVING COUNT (*) >= 5)
S2: SELECT C.name
FROM Class C
WHERE C.room = ‘R128’
OR C.name IN
(SELECT E.cname ,
FROM Enrolled E
GROUP BY E.cname
HAVING COUNT (*) >= 5)
Which of the following will result into set of student who are enrolled in course conducted in class R128 OR having five or more students enrolled in it?

Question 3

The five aggregation operators in SQL are?

Question 4

Which of the following SQL statement lists the number of customers in each country?

Question 5

Consider the following SQL query:

SELECT studentid, studentname
FROM student
WHERE birthyear >=ALL (SELECT birthyear from student)

Identify the answer returned by above query?

Question 6

Consider the following SQL Query over relational instance Emp (ename, Eid, deptno):
Select deptno
From Emp
GroupBy (deptno)
Having (count (*)> 3)
What does the above query result?
  • 76 attempts
  • 0 upvotes
  • 1 comment
May 21GATE & PSU CS