Problem Statement:-
I was going through relational algebra tutorial. I was wondering how would I write relational algebra query with a SQL JOIN query. I am facing a lot of problem on this-
Below is the question and its SQL query as well-
1) Find an Id of the Employee who has taken IT or BUSINESS training.
Code:
SELECT DISTINCT EmployeeID FROM Outcome O JOIN Training T ON T.TrainingCode = O.TrainingCode WHERE T.TrainingName = 'IT' OR T.TrainingName = 'BUSINESS';
2) Find the Id of employee who has taken every training.
Code:
SELECT X.EmployeeID
FROM (SELECT EmployeeID, COUNT(*) AS NumClassesTaken FROM OutCome GROUP BY EmployeeID ) AS X
JOIN
(SELECT COUNT(*) AS ClassesAvailable FROM Training) AS Y
ON X.NumClassesTaken = Y.ClassesAvailable;
What will be Relational Algebra example for the above two? Can anyone help me with this?