1
GATE CSE 2004
+2
-0.6
Consider two tables in a relational database with columns and rows as follows:

Table: Student

Roll_no Name Dept_id
1 ABC 1
2 DEF 1
3 GHI 2
4 JKL 3

Table: Department

Dept_id Dept_name
1 A
2 B
3 C

Roll_no is the primary key of the Student table, Dept_id is the primary key of the Department table and Studetn.Dept_id is a foreign key from
Department. Dept_id.

What will happen if we try to execute the following two SQL statements?
(i) update Student set Dept_id = Null where Roll_no =1
(ii) update Department set Dept_id = Null where Dept_id =1
A
Both (i) and (ii) will fail
B
(i) will fail but (ii) will succeed
C
(i) will succeed but (ii) will fail
D
Both (i) and (ii) will succeed
2
GATE CSE 2003
+2
-0.6
Consider the set of relations shown below and the SQL query that follows.

Students: (Roll_number, Name, Date_of_birth)
Courses: (Course number, Course_name, Instructor)

Select distinct Name
and Courses.Instructor = 'Korth'
and Grades.grade = 'A';
Which of the following sets is computed by the above query?
A
Names of students who have got an A grade in all courses taught by Korth
B
Names of students who have got an A grade in all courses
C
Names of students who have got an A grade in at least one of the courses taught by Korth
D
None of the above
3
GATE CSE 2000
+2
-0.6
Given relations r( w, x ) and s( y, z ), the result of

select distinct w,x
from r, s;
is guaranteed to be same as r, provided
A
r has no duplicates and s is non-empty
B
r and s have no duplicates
C
s has no duplicates and r is non-empty
D
r and s have the same number of tuples
4
GATE CSE 2000
+2
-0.6
In SQL, relations can contain null values, and comparisons with null values are treated as unknown. Suppose all comparisons with a null value are treated as false. Which of the following pairs is not equivalent?
A
x = 5        not (not (x = 5)
B
x = 5        x > 4 and x < 6,
where x is an integer
C
x ≠ 5        not (x = 5)
D
None of the above
GATE CSE Subjects
EXAM MAP
Medical
NEET