Question: How to do this query in SQL? Use a subquery in the WHERE clause to retrieve boat names from the voyages table where there is
How to do this query in SQL?
Use a subquery in the WHERE clause to retrieve boat names from the voyages table where there is no matching entry in the invoices table for the particular voyage number. Use a subquery with either NOT IN or NOT EXISTS (with a reference to the outer query).
Could someone help me with this?
This is the invoices table:
| # | number | invoice | chamber |
|---|---|---|---|
| 1 | 8300 | 9189 | A |
This is the voyages table:
| # | number | boatname | master | tonnage | type_of_boat | built | chamber | departure_date | departure_harbour | next_voyage |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 8300 | FAAM | Luur Runken | 136 | paketboot | 1788 | A | 1759 | Batavia | 8365
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
