Answer: Using CROSS JOIN
Find a detailed explanation of using CROSS JOIN in SQL.
Solution
The solution is given below:
Code explanation
The explanation of the solution code is given below:
Lines 2–4: The
SELECTstatement selects the columnsEName,CategoryName, and count of sales made using the aggregate function with theSalesIDcolumn. We useASto set an alias for the columns and tables.Line 5: The data is retrieved from the
Employeestable.Line 6: The
CROSS JOINis performed betweenEmployeesandProductCategories.Line 7: The
LEFT JOINis performed withSales,Employees, andProductCategorieson the columnsEIDandCategoryID.Line 8: The
GROUP BYspecifies theENameandCategoryNamecolumns to group the data. ...