create or replace view v_evaluations as
select
	evaluations.id,
    IF(evaluations.theme_id IS NULL, CONCAT(courses.name, ('Curso')), CONCAT(themes.name, ('Tema'))) as type_name,
    evaluations.description,
    evaluations.attempts,
    evaluations.approved_with,
    evaluations.time,
    evaluations.complexity,
    evaluations.status
from evaluations
left join courses on courses.id = evaluations.course_id
left join themes on themes.id = evaluations.theme_id;
