SQL Queries in MySQL This is using the Sakila Sample databas
SQL Queries in MySQL
This is using the Sakila Sample database which can download here:
https://dev.mysql.com/doc/sakila/en
Write a query that produce the last name and email address of every customer who has rented a film starring NICK WAHLBERG or MATTHEW JOHANSSON or RITA REYNOLDS (we don’t want to have duplicate rows returned for our query – there is a keyword you might need to use).
**Note that you will be performing a query on multiple tables**
SQL Queries in MySQL
This is using the Sakila Sample database which can download here:
https://dev.mysql.com/doc/sakila/en
Write a query that produce the last name and email address of every customer who has rented a film starring NICK WAHLBERG or MATTHEW JOHANSSON or RITA REYNOLDS (we don’t want to have duplicate rows returned for our query – there is a keyword you might need to use).
**Note that you will be performing a query on multiple tables**
SQL Queries in MySQL
This is using the Sakila Sample database which can download here:
https://dev.mysql.com/doc/sakila/en
Write a query that produce the last name and email address of every customer who has rented a film starring NICK WAHLBERG or MATTHEW JOHANSSON or RITA REYNOLDS (we don’t want to have duplicate rows returned for our query – there is a keyword you might need to use).
**Note that you will be performing a query on multiple tables**
Solution
select distinct customer.last_name,customer.email from customer
inner join inventory on customer.store_id = inventory.store_id
inner join film_actor on inventory.film_id = film_actor .film_id
inner join actor on film_actor.actor_id = actor.actor_id
where actor.first_name = \'NICK\' and actor.last_name =\'WAHLBERG \' or actor.first_name = \'MATTHEW\' and actor.last_name = \'JOHANSSON\' or actor.first_name = \'RITA and actor.last_name = \'REYNOLDS\';
