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]> 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 = 'HSH'; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 10 Current database: toyu +------------+----------+--------------+ | student | deptName | advisor | +------------+----------+--------------+ | Bill Ching | Arts | NULL | | Linda King | Arts | Art Allister | +------------+----------+--------------+ 2 rows in set (0.042 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]> SELECT DISTINCT s.stuId, -> CONCAT(s.fname, ' ', s.lname) AS student, -> s.ach, -> IFNULL(CONCAT(f.fname, ' ', f.lname), 'N/A') AS advisor -> FROM toyu.student AS s LEFT JOIN toyu.faculty AS f ON (s.advisor = f.facId) -> WHERE s.major = 'CSCI' ; +--------+------------+------+------------+ | stuId | student | ach | advisor | +--------+------------+------+------------+ | 100000 | Tony Hawk | 40 | Paul Smith | | 100001 | Mary Hawk | 35 | Paul Smith | | 100002 | David Hawk | 66 | Mary Tran | +--------+------------+------+------------+ 3 rows in set (0.001 sec) MariaDB [toyu]> notee