Assignment
University
California State UniversityCourse
IS 441 | Database Management SystemsPages
2
Academic year
2023
Alicia Webb
Views
0
07/09/2023 Answer this question below. 1. Make a SQL Query to show how many transactions with the films starring actor “Penelope Guiness” Answer : select count(r.rental_id) from actor a join film_actor fa on a.actor_id = fa.actor_id join film f on fa.film_id = f.film_id join inventory i on f.film_id = i.film_id join rental r on i.inventory_id = r.inventory_id where concat(a.first_name, a.last_name) = 'penelopeguiness' Here’s the output when we run the query : 2. Make a SQL Query to display 10 customers with the highest payment count. Answer : select c.first_name, c.last_name, count(p.rental_id) as rental_count from customer c left join rental r on c.customer_id = r.customer_id left join payment p on p.rental_id = r.rental_id group by 1,2 order by 3 desc limit 10
Here’s the output when we run the query :
PostgreSQL Practice #5
Please or to post comments