Film Category vs. City
Description
Write a query to find the number of occurrences of each film_category in each city. Arrange them in the decreasing order of their category count.
Answers
Answer:
स्क्ट्जयल जज्जफ़्ज़ज्फ् क्रिजयुगजग ज़ज्ञान
Answer: SELECT
name, city, COUNT(city) AS category_count
FROM
category
INNER JOIN
film_category USING (category_id)
INNER JOIN
film USING (film_id)
INNER JOIN
inventory USING (film_id)
INNER JOIN
store USING (store_id)
INNER JOIN
address USING (address_id)
INNER JOIN
Explanation:
SELECT
name, city, COUNT(city) AS category_count
FROM
category
INNER JOIN
film_category USING (category_id)
INNER JOIN
film USING (film_id)
INNER JOIN
inventory USING (film_id)
INNER JOIN
store USING (store_id)
INNER JOIN
address USING (address_id)
INNER JOIN
SELECT name, city, COUNT(category_id) AS category_count
FROM category
INNER JOIN film_category
USING (category_id)
INNER JOIN inventory
USING(film_id)
INNER JOIN store
USING (store_id)
INNER JOIN address
USING (address_id)
INNER JOIN city
USING (city_id)
GROUP BY name, city
ORDER BY category_count DESC;
#SPJ3