Im struggling with part of the SQL statement for an inner join.
Suppose we have 2 tables, Employee and Training Taken.
The Employee table has the following columns; EmployeeID, Name, Telephone, StartedEmployment. There are 4 records in the table ie EmpID numbers 1, 2, 3 & 4.
The Training Taken table has the following columns; TrainingTakenID, EmployeeID, TrainingTitle, TrainingDate. There are also 4 records in the table for employees with the ID 1, 2 & 3.
A straightforward statement to retrieve a list of employee names along with the title and date of any training they have been on would seem to be along the lines of
SELECT Employee.Name, TrainingTaken.TrainingTitle, TrainingTaken.TrainingDate
FROM Employee
INNER JOIN TrainingTaken ON Employee.EmployeeID = TrainingTaken.EmployeeID
Now, I can understand the identification of the table and column names and just about get my head around the inner join.
But what I dont understand is where does the FROM Employee part of the statement is there or needed since the Employee table is identified by Employee.Name isnt it?
Why would FROM Employee be used instead of FROM TrainingTaken?
Why does FROM Employee appear and not FROM TrainingTaken??
Suppose we have 2 tables, Employee and Training Taken.
The Employee table has the following columns; EmployeeID, Name, Telephone, StartedEmployment. There are 4 records in the table ie EmpID numbers 1, 2, 3 & 4.
The Training Taken table has the following columns; TrainingTakenID, EmployeeID, TrainingTitle, TrainingDate. There are also 4 records in the table for employees with the ID 1, 2 & 3.
A straightforward statement to retrieve a list of employee names along with the title and date of any training they have been on would seem to be along the lines of
SELECT Employee.Name, TrainingTaken.TrainingTitle, TrainingTaken.TrainingDate
FROM Employee
INNER JOIN TrainingTaken ON Employee.EmployeeID = TrainingTaken.EmployeeID
Now, I can understand the identification of the table and column names and just about get my head around the inner join.
But what I dont understand is where does the FROM Employee part of the statement is there or needed since the Employee table is identified by Employee.Name isnt it?
Why would FROM Employee be used instead of FROM TrainingTaken?
Why does FROM Employee appear and not FROM TrainingTaken??
Comment