Why the Select is before the From in a SQL Query?
- by Scorpi0
This is something that bothered me a lot at school.
5 years ago, when I learned SQL, I always wondered why we specify first the fields we want and then where we want them from.
According to my idea, we should write:
From Employee e
Select e.Name
So why the norm says:
Select e.Name -- Eeeeek, what e means ?
From Employee e -- Ok, now I know what e is
It took me weeks to understand SQL, and I know that a lot of that time was consumed by the wrong order of elements.
It is like writing in C#:
string name = employee.Name;
var employee = this.GetEmployee();
So, I assume that it has a historical reason, anyone knows why?