Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. mysql> select category.name, count(rental_id) from category join film_category on (category.category_id = film_category.category_id) join film on (film_category.film_id = film.film_id) join inventory on (film.film_id = inventory.film_id) join rental on (inventory.inventory_id = rental.inventory_id) group by category.name ;
  2. +-------------+------------------+
  3. | name | count(rental_id) |
  4. +-------------+------------------+
  5. | Action | 1112 |
  6. | Animation | 1166 |
  7. | Children | 945 |
  8. | Classics | 939 |
  9. | Comedy | 941 |
  10. | Documentary | 1050 |
  11. | Drama | 1060 |
  12. | Family | 1096 |
  13. | Foreign | 1033 |
  14. | Games | 969 |
  15. | Horror | 846 |
  16. | Music | 830 |
  17. | New | 940 |
  18. | Sci-Fi | 1101 |
  19. | Sports | 1179 |
  20. | Travel | 837 |
  21. +-------------+------------------+
  22. 16 rows in set (1.49 sec)
  23.  
  24. mysql> set ndb_join_pushdown = 1;
  25. Query OK, 0 rows affected (0.00 sec)
  26.  
  27. mysql> select category.name, count(rental_id) from category join film_category on (category.category_id = film_category.category_id) join film on (film_category.film_id = film.film_id) join inventory on (film.film_id = inventory.film_id) join rental on (inventory.inventory_id = rental.inventory_id) group by category.name ;
  28. +-------------+------------------+
  29. | name | count(rental_id) |
  30. +-------------+------------------+
  31. | Action | 1112 |
  32. | Animation | 1166 |
  33. | Children | 945 |
  34. | Classics | 939 |
  35. | Comedy | 941 |
  36. | Documentary | 1050 |
  37. | Drama | 1060 |
  38. | Family | 1096 |
  39. | Foreign | 1033 |
  40. | Games | 969 |
  41. | Horror | 846 |
  42. | Music | 830 |
  43. | New | 940 |
  44. | Sci-Fi | 1101 |
  45. | Sports | 1179 |
  46. | Travel | 837 |
  47. +-------------+------------------+
  48. 16 rows in set (0.42 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement