How do I insert data into a table that I created using a case expression?
Im trying to populate the table only with the high popularity movie categories.
INSERT INTO category_summary (most_popular)
SELECT category_name, rental_duration,
CASE
WHEN rental_duration <= 3
THEN 'Low Popularity'
WHEN rental_duration >= 4
AND rental_duration < 6 THEN 'Medium Popularity'
WHEN rental_duration >= 6 THEN 'High Popularity'
END popularity
FROM category_description
WHERE popularity = 'High Popularity'
ORDER BY category_name;
ERROR: column "popularity" does not exist
LINE 11: WHERE popularity = 'High Popularity'