6
I would like to know how I can do a search that returns records that are not part of the research condition.
For example, think about the situation where there is a database of a movie rental company with the table cliente
and the table aluguel
. The table cliente
has a tuple cliente_id
and the table aluguel
has a tuple cliente_id
.
What I want is to see the names of customers who have never rented a movie, IE, I wanted my query to return all names that do not satisfy the script below:
`select first_name, last_name from customer
inner join rental on customer.customer_id = rental.customer_id;`
About the
NOT EXISTS
, I’d still put oneLIMIT 1
to already indicate to the SQL engine to exit on the first line found– Jefferson Quesado
Includes the
LIMIT 1
subselect– Caique Romero