1 DROP VIEW community_view;
3 CREATE VIEW community_view AS
4 with all_community AS (
13 c.creator_id = u.id) AS creator_name,
20 c.category_id = ct.id) AS category_name,
27 cf.community_id = c.id) AS number_of_subscribers,
34 p.community_id = c.id) AS number_of_posts,
43 AND p.id = co.post_id) AS number_of_comments
57 AND ac.id = cf.community_id) AS subscribed
60 CROSS JOIN all_community ac