Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

did what i could #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anaaristow
Copy link

No description provided.

@bripollc
Copy link

bripollc commented Nov 7, 2023

Anna!!!!!! Finally I see you got the trick of the subqueries!!!! Some of them don't return exactly what the question requires but overall good job understanding the syntax and fighting with SQL! 🧘🏻‍♀️In the end we didn't take the time to look at it together but if you have doubts in the future you can ask the new TA!

I have to say that I had a bit of trouble reading your file because there are no titles and the queries are all together, one after the other.... It would help a bit to put the statement of what you are trying to answer:) I leave you a couple of clueless and also an option to solve questions 7 and 8 ✨.

  • 1 - You are not returning the correct information. It asks you for the number of copies in the inventory, not the information about the film.
SELECT title, COUNT(title) FROM film
	LEFT JOIN inventory
		ON film.film_id = inventory.film_id
        WHERE film.title = "Hunchback Impossible";
  • 3 - There are several attempts in your document but I think you had not reached the final query to display the names of the actors? I leave it here just in case:)
SELECT actor.first_name, actor.last_name
	FROM actor
    INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id
    WHERE film_actor.film_id in (SELECT film_id FROM film WHERE title = "Alone Trip");
  • 7 -
SELECT film.title
FROM film
INNER JOIN inventory ON film.film_id = inventory.film_id
INNER JOIN rental ON inventory.inventory_id = rental.inventory_id
WHERE rental.customer_id = (
    SELECT customer_id
    FROM payment
    GROUP BY customer_id
    ORDER BY SUM(amount) DESC
    LIMIT 1
);
  • 8 -
SELECT customer_id, SUM(amount) as total_amount_spent FROM payment
	GROUP BY customer_id
    HAVING total_amount_spent > (SELECT AVG(total_amount_spent) FROM
		(SELECT customer_id, SUM(amount) as total_amount_spent FROM payment GROUP BY customer_id) AS amount)
	ORDER BY total_amount_spent DESC;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants