Question: UNION Set Operator
Explore how to write SQL queries using the UNION set operator to combine results from multiple tables. This lesson helps you retrieve employee names with assigned projects and include projects without employees by adding placeholders. You will gain skills in managing real-world data scenarios and effectively using the UNION operator for comprehensive reporting.
We'll cover the following...
Question
Let’s say you’re part of a team that is managing a database, consisting of three tables, for your company. One of the table is Employees, which holds important details like names and salaries. The second table, Skills, contains information about the employee’s skills. The third table is named Projects, and it holds the information regarding the projects. The table structures are as follows:
Employees
EmpID | EmpName | Salary |
1 | Susan Lee | 50000.00 |
2 | Alexa Smith | 60000.00 |
3 | Sana Amberson | 45000.00 |
4 | Sarah Ronald | 47000.00 |
Skills
SkillID | EmpID | SkillName |
1 | 1 | C++ |
2 | 4 | Java |
3 | 1 | Python |
4 | 3 | Blender |
5 | NULL | Android |
Projects
ProjectID | EmpID | SkillID | ProjectName |
1 | 1 | 1 | Industrial Robot |
2 | 4 | 2 | Multiplatform GUI |
3 | 3 | 4 | 3D Simulation |
4 | 1 | 3 | Deep Learning Model |
5 | NULL | NULL | IOS App |
6 | 1 | NULL | Advanced Calculator |
7 | NULL | 5 | Android App |
Additional information
The ...