Essentially, the answer to your question is that the output from a SQL SELECT
query is not a relation, and therefore if you do not take care you may end up with duplicate attribute names (columns) and rows.
Standard SQL has some constructs to mitigate SQL's non-relational problems e.g. NATURAL JOIN
would ensure the result has only one EmpID
attribute. Sadly, SQL Server does not support this syntax but you can vote for it here.
Therefore, you are forced to write out in long-hand the columns you want, using the table name to qualify which attribute you prefer e.g. employee.EmpID
.