From 5758f229bf2aa2d0bfb60784300cb43cfe75759c Mon Sep 17 00:00:00 2001 From: Robert Nickel Date: Mon, 31 Jan 2022 18:18:15 +0100 Subject: [PATCH] Fixed left join syntax: use _on_ not _where_. --- www/_blog/2020-11-18-postgresql-views.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/www/_blog/2020-11-18-postgresql-views.mdx b/www/_blog/2020-11-18-postgresql-views.mdx index ce121b70a1d..af57c6e40bb 100644 --- a/www/_blog/2020-11-18-postgresql-views.mdx +++ b/www/_blog/2020-11-18-postgresql-views.mdx @@ -62,8 +62,8 @@ create view transcripts as courses.code, grades.result from grades - left join students where grades.student_id = students.id - left join courses where grades.course_id = courses.id; + left join students on grades.student_id = students.id + left join courses on grades.course_id = courses.id; ``` Once done, we can now access the underlying query with: @@ -95,8 +95,8 @@ select courses.code, grades.result from grades -left join students where grades.student_id = students.id -left join courses where grades.course_id = courses.id; +left join students on grades.student_id = students.id +left join courses on grades.course_id = courses.id; ``` We can run this instead: @@ -119,8 +119,8 @@ select courses.code, grades.result from grades - left join students where grades.student_id = students.id - left join courses where grades.course_id = courses.id + left join students on grades.student_id = students.id + left join courses on grades.course_id = courses.id where courses.code != 'PG101'; ``` @@ -151,8 +151,8 @@ create materialized view transcripts as courses.code, grades.result from grades - left join students where grades.student_id = students.id - left join courses where grades.course_id = courses.id; + left join students on grades.student_id = students.id + left join courses on grades.course_id = courses.id; ``` Reading from the materialized view is the same as a conventional view: