So we want to do some SELECTive deleting of loans based on the
Branch City, but we don't have that column in our Loan table, just the
Branch Name. Sounds like a good place to start
DELETE
FROM Loan
WHERE Branch_Name
Now we do have a branch table that has the names and cities within it... lets see what this will give us something like this
SELECT Branch_Name
FROM Branch
WHERE Branch_City = 'Needham city'
Now to use this within the DELETE command, we will use the
IN
to call the SELECT as a subquery
DELETE
FROM Loan
WHERE Branch_Name IN (
SELECT Branch_Name
FROM Branch
WHERE Branch_City = 'Needham city'
)