lsqlthw ex8
This commit is contained in:
parent
920c85be6a
commit
f12fbd7682
18
lsqlthw-remnants/ex8.sql
Normal file
18
lsqlthw-remnants/ex8.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
DELETE FROM pet WHERE id IN (
|
||||||
|
SELECT pet.id
|
||||||
|
FROM pet, person_pet, person
|
||||||
|
WHERE
|
||||||
|
person.id = person_pet.person_id AND
|
||||||
|
pet.id = person_pet.pet_id AND
|
||||||
|
person.first_name = "Zed"
|
||||||
|
);
|
||||||
|
|
||||||
|
SELECT * FROM pet;
|
||||||
|
SELECT * FROM person_pet;
|
||||||
|
|
||||||
|
DELETE FROM person pet
|
||||||
|
WHERE pet id NOT IN (
|
||||||
|
SELECT id FROM pet
|
||||||
|
);
|
||||||
|
|
||||||
|
SELECT * FROM person_pet;
|
Loading…
Reference in New Issue
Block a user