Consider the city and country tables are given by the following DESCRIBE output extracts.
mysql> DESC Country;
Note: The CountryCode field in the city table references the code field in the country table.
Which of the following delete statements the country “Spain” along with all of it’s cities?
A.
DELETE Country, City FROM Country, City
WHERE Country.Code=City.CountryCode AND Country.Name=’Spain’
B.
DELETE FROM Country JOIN City ON Country.Code=City.CountryCode
WHERE Country.Name = ‘Spain’
C.
DELETE Country, City
USING Country.Code=City.CountryCode
WHERE Country.Name=’Spain’
D.
DELETE FROM Country, City
WHERE Country.Code=City.CountryCode AND Country.Name=’Spain’
Explanation:
A names both tables after DELETE – instructs MySQL to delete from both. (B doesn’t). C and D name both tables, but don’t join them.