create or replace view v_contents as
select
	contents.id,
    contents.name,
    contents.theme_id,
    themes.name as theme_name,
    courses.id as course_id,
    courses.name as course_name,
    contents.tags,
    contents.type,
    (CASE
        WHEN contents.type = 1 THEN 'Video'
        WHEN contents.type = 2 THEN 'Documento'
        WHEN contents.type = 3 THEN 'Galería'
     	WHEN contents.type = 3 THEN 'Artículo'
    END) as type_name,
    contents.status,
    contents.evaluable
from contents
join themes on themes.id = contents.theme_id
join courses on courses.id = themes.course_id;
