
No Rental
Paulo R. Rodegheri Brazil
The video store company intends to do a promotion for customers who have not yet done any rental.
Your job is to deliver us the ID and the name of the customers who have not done any rental. Sort the output by ID.
Schema
Column | Type |
id (PK) | numeric |
name | varchar |
street | varchar |
city | varchar |
Column | Type |
id (PK) | numeric |
locations_date | date (ISO/YMD) |
id_customers (FK) | numeric |
Tables
id | name | street | city |
1 | Giovanna Goncalves Oliveira | Rua Mato Grosso | Canoas |
2 | Kauã Azevedo Ribeiro | Travessa Ibiá | Uberlândia |
3 | Rebeca Barbosa Santos | Rua Observatório Meteorológico | Salvador |
4 | Sarah Carvalho Correia | Rua Antônio Carlos da Silva | Apucarana |
5 | João Almeida Lima | Rua Rio Taiuva | Ponta Grossa |
6 | Diogo Melo Dias | Rua Duzentos e Cinqüenta | Várzea Grande |
id | locations_date | id_customers |
1 | 2016-10-09 | 3 |
2 | 2016-09-02 | 1 |
3 | 2016-08-02 | 4 |
4 | 2016-09-02 | 2 |
5 | 2016-03-02 | 6 |
6 | 2016-04-04 | 4 |
Output Sample
id | name |
5 | João Almeida Lima |
N.B.: It's better if you solve this by your own. Thank you!
URI - BEECROWD Online Judge 2616 Solve in SQL:
-- Solved by IntesarSELECT id, nameFROM customersWHERE id not in( SELECT id_customers FROM locations);
0 Comments