MariaDB [(none)]> use toyu Database changed MariaDB [toyu]> SELECT CONCAT (s.fname, ' ', s.lname) AS student, -> d.deptName, -> CONCAT(f.fname, ' ', f.lname) as advisor -> FROM student AS s LEFT JOIN department AS d -> ON (s.major = d.deptCode) -> LEFT JOIN faculty AS f -> ON (s.advisor = f.facId); +-----------------+------------------------------+--------------+ | student | deptName | advisor | +-----------------+------------------------------+--------------+ | Tony Hawk | Computer Science | Paul Smith | | Mary Hawk | Computer Science | Paul Smith | | David Hawk | Computer Science | Mary Tran | | Catherine Lim | Information Technology | NULL | | Larry Johnson | Information Technology | Deborah Gump | | Linda Johnson | Computer Information Systems | Daniel Kim | | Lillian Johnson | Computer Information Systems | Andrew Byre | | Ben Zico | NULL | NULL | | Bill Ching | Arts | NULL | | Linda King | Arts | Art Allister | | Cathy Johanson | NULL | Art Allister | +-----------------+------------------------------+--------------+ 11 rows in set (0.002 sec) MariaDB [toyu]> SELECT CONCAT (s.fname, ' ', s.lname) AS student, -> d.deptName, -> CONCAT(f.fname, ' ', f.lname) as advisor -> FROM student AS s LEFT JOIN department AS d -> ON (s.major = d.deptCode) -> LEFT JOIN faculty AS f -> ON (s.advisor = f.facId) -> WHERE d.schoolCode = 'CSE'; +-----------------+------------------------------+--------------+ | student | deptName | advisor | +-----------------+------------------------------+--------------+ | Linda Johnson | Computer Information Systems | Daniel Kim | | Lillian Johnson | Computer Information Systems | Andrew Byre | | Tony Hawk | Computer Science | Paul Smith | | Mary Hawk | Computer Science | Paul Smith | | David Hawk | Computer Science | Mary Tran | | Catherine Lim | Information Technology | NULL | | Larry Johnson | Information Technology | Deborah Gump | +-----------------+------------------------------+--------------+ 7 rows in set (0.001 sec) MariaDB [toyu]> notee