Practice Interview Questions
| Question | Status |
|---|---|
Write a query that shows the number of seats not yet purchased for each flight_id.
flights table:
| Column Name | Description |
|---|---|
| flight_id | Unique identifier for each flight |
| plane_id | Identifier to the plane used for the flight |
planes table:
| Column Name | Description |
|---|---|
| plane_id | Unique identifier for each plane |
| number_of_seats |
Write a query that shows the number of seats not yet purchased for each flight_id.
flights table:
| Column Name | Description |
|---|---|
| flight_id | Unique identifier for each flight |
| plane_id | Identifier to the plane used for the flight |
planes table:
| Column Name | Description |
|---|---|
| plane_id | Unique identifier for each plane |
| number_of_seats |
| Total number of seats available on the plane |
purchases table:
| Column Name | Description |
|---|---|
| flight_id | Identifier linking to the flight purchased |
| seat_no | Number of the seat from the purchase |
| flight_id | number_of_seats_not_yet_purchased |
|---|---|
| 1 | 11 |
| 2 | 27 |
| 3 | 37 |
| Total number of seats available on the plane |
purchases table:
| Column Name | Description |
|---|---|
| flight_id | Identifier linking to the flight purchased |
| seat_no | Number of the seat from the purchase |
| flight_id | number_of_seats_not_yet_purchased |
|---|---|
| 1 | 11 |
| 2 | 27 |
| 3 | 37 |