diff --git a/8_using_null.sql b/8_using_null.sql index 939c9eb..ded1dde 100644 --- a/8_using_null.sql +++ b/8_using_null.sql @@ -24,8 +24,9 @@ SELECT name, COALESCE(mobile, '07986 444 2266') -- # 6. Use the COALESCE function and a LEFT JOIN to print the name and -- #department name. Use the string 'None' where there is no -- #department. -SELECT name, COALESCE(dept, 'None') - FROM teacher; +SELECT teacher.name, COALESCE(dept.name,'None') + FROM teacher LEFT JOIN dept + ON teacher.dept=dept.id -- # 7. Use COUNT to show the number of teachers and the number of -- #mobile phones. @@ -62,4 +63,4 @@ SELECT teacher.name, THEN 'Art' ELSE 'None' END -FROM teacher; \ No newline at end of file +FROM teacher;