Answer: Using RIGHT JOIN
Find a detailed explanation of how to apply RIGHT JOIN on tables.
Solution
The solution is given below:
Press + to interact
MySQL
/* The query to apply RIGHT JOIN */SELECT e.EmpName, p.ProjectNameFROM Employees AS eRIGHT JOIN Projects AS p ON e.EmpID = p.EmpID;
Explanation
The explanation of the solution code is given below:
Line 2: The
SELECTquery selectsEmpNameandProjectNamefromEmployeesandProjects, respectively.Line 3: The data is retrieved from the
Employeestable. We useASto set an alias for the tables.Line 4:
RIGHT JOINis applied withProjectson columnsEmpIDin both the tables. ...
Ask