Views
8. Views based on views
Revision

Instruction

Perfect! As we already mentioned, views work just like tables. This means we can create a view which will be based on another view. Let's try that out.

Exercise

Create a view current_course_lecturer which will show the name and description of all current courses with the first and last name of their lecturers. Use the view current_course and the ERD below to help you.

Tables in the database

Stuck? Here's a hint!

Type

CREATE VIEW current_course_lecturer AS 
SELECT name, description, first_name, last_name FROM current_course JOIN lecturer ON current_course.lecturer_id = lecturer.id;

Console

Code editor

Result

TableConsole