linq isn't meant to be sql. it's meant to be a query language which is as independent of the data source as reasonably possible. now admittedly it has a strong sql bias, but it's not meant to just be embedding sql in source code (fortunately).
personally, i vastly prefer linq's syntax to sql's. in particular, the ordering is much more logical in linq. just by looking at the order of the query clauses, you can see the logical order in which the query is processed. you start with a data source, possibly do some filtering, ordering etc, and usually end with a projection or grouping. compare that with sql, where you start off saying which columns you're interested in, not even knowing what table you're talking about yet.
not only is linq more logical in that respect, but it allows tools to work with you better - if visual studio knows what data you're starting with, then when you start writing a
select clause (for example) it can help you with intellisense. additionally, it allows the translation from linq query expressions into "dot notation" to be relatively simple using extension methods, without the compiler having to be aware of any details of what the query will actually do.
so from my point of view: no, linq would be a lot worse if it had slavishly followed sql's syntax.
the reason is the c# language designers use this approach because of when i first specify where the data is coming from, now visual studio and the c# compiler know what my data looks like. and i can have intellisense help in the rest of the query because visual studio will know that "city" (for example) is a string, and it has operations like startswith and a property named length. and really, inside of a relational database like sql server, the select clause that you are writing in a sql statement at the top is really one of the last pieces of the information the query engine has to figure out. before that it has to figure out what table you are working against in the from clause even though the from clause comes later in sql syntax
it is simpler to parse expression when initial data is provided in its beginning.
because of this vs provides code completion even for partially written linq queries (great feature imo).
first, choose your flavor of sql - there are several! (t-, pl-, etc).
ultimately, there are similarities and differences. a lot of the linq changes make more sense - i.e. choosing your source (
from) before you try filtering (
where) / projection (
select), allowing better static analysis etc (including intellisense), and a more natural query comprehension syntax. this helps both the developer and the compiler, so i'm happy.
- How are people unit testing code that uses Linq to SQL
- Syntax to execute code block inside Linq query?
- SQL Query to LINQ syntax using not exist and join
- LINQ Source Code Available
- SQL ROW_NUMBER() in LINQ Query Syntax
- How to code the partial extensions that Linq to SQL autogenerates?
- npgsql LINQ creates SQL Server sql syntax
- Determine the source DataContext for a Linq to Sql query
- LINQ syntax vs SQL syntax
- How to get SQL query into LINQ form in C# code
- creating Linq to sqlite dbml from DbLinq source code
- Linq to Sql - Incorrect syntax by keyword 'IS'
- Does LINQ convert code to SQL queries
- How do i convert this linq code to inline sql
- Reuse Linq to SQL code with entityframework
- Identify source of linq to sql query
- Linq to sql as object data source - designer problem with partial classes
- Incorrect sql syntax in EpiServer DynamicDataStore LINQ statement
- linq to sql syntax different but should get the same results
- linq syntax to match dynamic sql IN statement
- SQL subquery result in LINQ and Entity Framework Code First
- Accessing SQL Server time in code with LINQ
- Linq to sql query: how to prevent duplication of code
- convert linq to object query to sql query (no linq to sql code or datacontext)
- LINQ to SQL .Join syntax
- Linq union all equivalent of sql code
- Convert SQL query to LINQ method syntax in C#
- Linq to SQL translation to SQL syntax
- Translating Linq Code Block into SQL
- Linq 2 SQL Syntax Help
More Query from same tag
- How to optimize this LINQ to EF/Sql query (many to many to many relationship)?
- Combine each element in collection in object with the object itself in LINQ
- LINQ to SQL: Selecting Name (string) by id (smallint)
- Linq Left Join on the table which have a higher number of records
- Why does Linq does not order my result immediately
- LINQ find all child entities meet requirements
- C# Linq GroupBy and Select performance
- reading data from multiple excel sheets with linq to excel (http://code.google.com/p/linqtoexcel/)
- Query a binary tree
- How to sort a collection based on type in LINQ
- How to change a string content according to another string with LINQ C#
- Efficient Way to SQL Csv w/ > 255 Columns in C#?
- How to include child properties using Entity Framework
- How to make a custom order with Dictionary in C#?
- Expression for ICollection<T>.Any(Func<T, bool>)
- Selecting XML nodes using LINQ
- Method MAX() from SQL to Linq
- OrderBy Signature Error in Pro LINQ book?
- Split value into two with LINQ
- Is it possible to group by an object property but have the whole object in the Key?
- Iqueryable can't call Include method
- C# LINQ NET 3.5 SP1: Using LINQ to group by two fields and assigning a correlative unique ID (integer number) to all member of the group
- Loading and Filtering Huge Amount of Data using Linq
- Can I Inline static method call to EF query
- Sort object that contains List and update object using LINQ
- Subtraction in LINQ
- Restrict LINQ Subquery when databound to a grid
- Filter a list based on the most found keywords
- error adding value to list entity (LINQ C#) MVC 4
- Compilation error in one case but not the other, when all expressions have same types