Computer Science, asked by pranavpdolas, 5 days ago

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.

Attachments:

Answers

Answered by navdeepmalik1254
0

Answer:

स्क्ट्जयल जज्जफ़्ज़ज्फ् क्रिजयुगजग ज़ज्ञान

Answered by pinkypearl301
0

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

Similar questions