SQL: GATE CS Previous Year Questions

SQL · Databases

43 questions · asked in 23 of 27 years (2000–2026)

MCQ 34 · MSQ 1 · NAT 81-mark 26 · 2-mark 17

2000Questions per year2026

Questions 36–40 of 43

Q36GATE 20041 markMCQ−0.33 if wrong
A relational database contains two tables student and department in which student table has columns roll_no, name and dept_id and department table has columns dept_id and dept_name. The following insert statements were executed successfully to populate the empty tables:
Insert into department values (1, 'Mathematics')
Insert into department values (2, 'Physics')
Insert into student values (l, 'Navin', 1)
Insert into student values (2, 'Mukesh', 2)
Insert into student values (3, 'Gita', 1)
How many rows and columns will be retrieved by the following SQL statement?
Select * from student, department 

Q37GATE 20041 markMCQ−0.33 if wrong
The employee information in a company is stored in the relation

Employee (name‾\underline{name}, sex, salary, deptName)

Consider the following SQL query
 select deptName
       from Employee
       where sex = 'M'
       group by deptName
       having avg (salary) > (select avg (salary) from Employee) 
It returns the names of the department in which

Q38GATE 20041 markMCQ−0.33 if wrong
Consider the following relation schema pertaining to a students database:

Students (rollno‾\underline{rollno}, name, address)
Enroll (rollno‾\underline{rollno} ,courseno‾\underline{courseno}, coursename)

Where the primary keys are shown underlined. The number of tuples in the student and Enroll tables are 120 and 8 respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll), where '*' denotes natural join?

Q39GATE 20031 markMCQ−0.33 if wrong
Consider the set of relations shown below and the SQL query that follow:

Students:(Roll_number,Name,Date_of_birth)
Courses:(Course_number,Course_name,Instructor)
Grades:(Roll_number,Course_number,Grade)
select distrinct Name
from Students, Courses, Grades
Where Students.Roll_number=Grades.Toll_number
and Courses.Instructor= 'Korth'
and Courses.Course_number=Grades.Course_number
and Grades.grade= 'A' 
Which of the following sets is computed by the above query?

Q40GATE 20031 markMCQ−0.33 if wrong
Consider the following SQL query
select distinct a1,a2,…,ana_1, a_2, \ldots, a_n
from r1,r2,…,rmr_1, r_2, \ldots, r_m
where P
For an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions?
A. Πa1,a2,…an σp (r1×r2×⋯×rm)\Pi_{a_1,a_2,\ldots a_n}\,\sigma_p\,(r_1 \times r_2 \times \cdots \times r_m)
B. Πa1,a2,…an σp (r1⋈r2⋈⋯⋈rm)\Pi_{a_1,a_2,\ldots a_n}\,\sigma_p\,(r_1 \bowtie r_2 \bowtie \cdots \bowtie r_m)
C. Πa1,a2,…an σp (r1∪r2∪⋯∪rm)\Pi_{a_1,a_2,\ldots a_n}\,\sigma_p\,(r_1 \cup r_2 \cup \cdots \cup r_m)
D. Πa1,a2,…an σp (r1∩r2∩⋯∩rm)\Pi_{a_1,a_2,\ldots a_n}\,\sigma_p\,(r_1 \cap r_2 \cap \cdots \cap r_m)

Keep practising

Topics in Databases

All CS topics ›