Created
August 17, 2011 17:15
-
-
Save toreriklinnerud/1152050 to your computer and use it in GitHub Desktop.
Example database view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP VIEW IF EXIXTS student_views; | |
CREATE VIEW student_views AS | |
SELECT | |
students.id AS id, | |
students.name AS name, | |
teachers.name AS teacher_name, | |
schools.name AS school_name, | |
countries.name AS country_name | |
FROM students | |
LEFT JOIN teachers ON teachers.id = students.teacher_id | |
LEFT JOIN schools ON schools.id = students.school_id | |
LEFT JOIN countries ON countries.id = students.country_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment