For this exercise I've created a db fiddle that sets up a table and data for you.
Your company has stopped using a few software vendors, so they want you to delete them from the vendors table. However, some still have a pending delivery.
These are the vendors your company has stopped doing business with:
Strategical.ly
Deliver.academy
This is what the vendors table looks like:
| id | name | next_delivery | | --- | --------------- | ------------- | | 1 | Strategical.ly | pending | | 2 | Techvology | done | | 3 | Deliver.academy | done | | 4 | Software house | pending | | 5 | ideasservice | done |
Delete the vendors that don't have a pending delivery who your company has stopped doing business with.
This query would delete vendors with the right name that have completed their delivery.
DELETE FROM vendors WHERE (name = 'Strategical.ly' OR name = 'Deliver.academy') AND next_delivery = 'done';
Remember to check the result after, to see if it's correct!
SELECT * FROM vendors;
The output should be:
| id | name | next_delivery | | --- | -------------- | ------------- | | 1 | Strategical.ly | pending | | 2 | Techvology | done | | 4 | Software house | pending | | 5 | ideasservice | done |