Eight words:
From ...in clause: The data source and scope variables to perform the query operation on
var q = from c in db.Customers from o in c.Orders where c.City == "London" select o;
Select clause: specify the type and representation of query results
var q = from c in db.Customers select c.ContactName;
Where clause: Logical conditions for filtering elements, generally composed of logical operators
var q = from c in db.Customers where c.City == "London" select c;
Example: Use where to filter customers in London
var q = from c in db.Customers where c.City == "London" select c;
Group...by clause: group the query
var q = from p in db.Products group p by p.CategoryID into g select g;
Orderby clause: Sort the query results, which can be divided into descending order and ascending order.
var q = from c in db.Customers orderby c.City, c.ContactName select c;
Join clause: joins data sources for multiple query operations
var q = from e in db.Employees join o in db.Orders on e equals o.Employee into ords from o in ords.DefaultIfEmpty() select new { e.FirstName, e.LastName, Order = o };
Let Clause: Introduce scope variables for storing the results of subexpressions in query expressions
var query = from sentence in strings let words = sentence.Split(' ')//Split into arrays with spaces from word in words let w = word.ToLower()// Lowercase each letter where w[0] == 'a' || w[0] == 'e' select word;
Into clause: Provides a temporary identifier that acts as a result of a join, group or select clause
var byHow = from how in vehicles join trans in transports on how.vehicleHow equals trans.How into lst // this lst is of type IEnumerable<transport> select new { How=how, Tlist = lst };