Ejemplos left/right join


SELECT country,count(city_id) total FROM sakila.country left join city using(country_id)
group by country_id
having total=0

select country from country left join city using(country_id)
where city_id is null

select * from film left join film_actor using(film_id)
where actor_id is null;

select * from film_actor right join film using(film_id)
where actor_id is null;

select * from actor left join film_actor using(actor_id)
where film_id is null

SELECT * FROM customer left join rental using(customer_id)
where rental_id is null

Publicado por

Avatar del usuario

Juan Pablo Fuentes

Formador de programación y bases de datos