views:

44

answers:

1

Here in this video at 11th minute, while explaining about strange structure (compared to SQL) of LINQ query, Anders Hejlsberg says that "Scope of variables in SQL flows backward in SQL", What does he mean by that? I'm totally confused... :(

+2  A: 

Consider this simple SQL statement:-

 SELECT FirstName, LastName FROM People

Lexically we establish what fields we want (FirstName, LastName) from whatever before we define where we are getting them from (People). Whereas:-

var query = from People select new {FirstName, LastName}

Lexically we establish from where we are getting data (People) before we define which specific bits of that data we want (FirstName, LastName). The SQL approach is backward.

AnthonyWJones
Nah, in practice we do SELECT * FROM People and then work out which columns we need :)
onedaywhen