Database-Management-System
August 29, 2024
Database-Management-System
August 29, 2024
Database-Management-System
August 29, 2024
Database-Management-System
August 29, 2024

Database-Management-System

Question 262

Consider the following SQL schema for a database about schoors in a university and departments in the schools. Data types are omitted for brevity.

create table School (schoolName primary key, dean)

create table Dept (deptName primary key,

schoolName references School on delete cascade)

Write a single SQL statement that deletes all schools with more than 10 departments and also deletes all departments in those schools.

A
delete from School
where 10<(select count (*) from School
where Dept.schoolName=School.schoolName)
B
delete from School
where 10 < (select count (*) from Dept
where Dept.schoolName=school.schoorNanre)
C
delete from School
where 10 <= (select count (*) from Dept
Dept.schoonName=School.schoolName)
D
None of the above.
Question 262 Explanation: 
Option B is the correct SQL query.
Option A is wrong because the subquery contains School schema instead of Dept schema.
Option C is wrong because in question it is clearly said “more than 10” and not “more than or equal to 10”.
Correct Answer: B
Question 262 Explanation: 
Option B is the correct SQL query.
Option A is wrong because the subquery contains School schema instead of Dept schema.
Option C is wrong because in question it is clearly said “more than 10” and not “more than or equal to 10”.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!