Database-Management-System
August 29, 2024Database-Management-System
August 29, 2024Database-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.
delete from School
where 10<(select count (*) from School where Dept.schoolName=School.schoolName) |
|
delete from School
where 10 < (select count (*) from Dept where Dept.schoolName=school.schoorNanre) |
|
delete from School
where 10 <= (select count (*) from Dept Dept.schoonName=School.schoolName) |
|
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”.
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”.
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”.
Subscribe
Login
0 Comments