Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select "fullname", coalesce("Action", 0) as "Action", coalesce("Animation",0) as "Animation", coalesce("Children" ,0) as "Children", coalesce("Classics" ,0) as "Classics", coalesce("Comedy" ,0) as "Comedy", coalesce("Documentary" ,0) as "Documentary", coalesce("Drama" ,0) as "Drama", coalesce("Family" ,0) as "Family", coalesce("Foreign" ,0) as "Foreign", coalesce("Games" ,0) as "Games", coalesce("Horror" ,0) as "Horror", coalesce("Music" ,0) as "Music", coalesce("New" ,0) as "New", coalesce("Sci-Fi" ,0) as "Sci-Fi", coalesce("Sports" ,0) as "Sports", coalesce("Travel" ,0) as "Travel"
- from crosstab
- ('select concat(a.first_name, '' '', last_name) as "fullname", c.name as "category", count(*)
- from actor a,
- film f,
- film_actor fa,
- film_category fc,
- category c
- where a.actor_id = fa.actor_id
- and f.film_id = fa.film_id
- and f.film_id = fc.film_id
- and fc.category_id = c.category_id
- group by a.actor_id, category
- order by last_name, first_name, category', 'select distinct "name"
- from category
- order by 1')
- as tablename(fullname text, "Action" integer, "Animation" integer, "Children" integer, "Classics" integer, "Comedy" integer, "Documentary" integer, "Drama" integer, "Family" integer, "Foreign" integer, "Games" integer, "Horror" integer, "Music" integer, "New" integer, "Sci-Fi" integer, "Sports" integer, "Travel" integer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement