Why the Select is before the From in a SQL Query?
Posted
by
Scorpi0
on Programmers
See other posts from Programmers
or by Scorpi0
Published on 2011-12-30T13:34:00Z
Indexed on
2012/03/21
11:38 UTC
Read the original article
Hit count: 226
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?
© Programmers or respective owner