SQL-LINQ-Lambda语法对照
SQL |
LINQ |
Lambda |
SELECT *FROM HumanResources.Employee |
from e in Employees select e |
Employees .Select (e => e) |
SELECT e.LoginID, e.JobTitle FROM HumanResources.Employee AS e |
from e in Employees select new {e.LoginID, e.JobTitle} |
Employees.Select ( |
SELECT e.LoginID AS ID, e.JobTitle AS FROM HumanResources.Employee AS e |
from e in Employees select new {ID = e.LoginID, Title = |
Employees.Select ( |
SELECT DISTINCT e.JobTitle FROM HumanResources.Employee AS e |
(from e in Employees select e.JobTitle).Distinct() |
Employees |
SELECT e.* FROM HumanResources.Employee AS e WHERE e.LoginID = 'test' |
from e in Employees where e.LoginID == "test" select e |
Employees |
SELECT e.* FROM HumanResources.Employee AS e WHERE e.LoginID = 'test' AND |
from e in Employees where e.LoginID == "test" select e |
Employees |
SELECT e.* FROM HumanResources.Employee WHERE e.VacationHours >= 2 AND |
from e in Employees where e.VacationHours >= 2 && select e |
Employees |
SELECT e.* FROM HumanResources.Employee |
from e in Employees orderby e.NationalIDNumber select e |
Employees |
SELECT e.* FROM HumanResources.Employee ORDER BY e.HireDate DESC, |
from e in Employees orderby e.HireDate descending, select e |
Employees |
SELECT e.* FROM HumanResources.Employee WHERE e.JobTitle LIKE 'Vice%' OR |
from e in Employees where select e |
Employees |
SELECT SUM(e.VacationHours) FROM HumanResources.Employee AS e |
Employees.Sum(e => e.VacationHours); |
|
SELECT COUNT(*) FROM |
Employees.Count(); |
|
SELECT SUM(e.VacationHours) AS FROM HumanResources.Employee AS e GROUP BY e.JobTitle |
from e in Employees group e by e.JobTitle into g select new {JobTitle = g.Key, |
Employees |
SELECT e.JobTitle, SUM(e.VacationHours) FROM HumanResources.Employee AS e GROUP BY e.JobTitle HAVING e.COUNT(*) > 2 |
from e in Employees group e by e.JobTitle into g where g.Count() > 2 select new {JobTitle = g.Key, |
Employees |
SELECT * FROM Production.Product AS p, |
from p in Products from pr in ProductReviews select new {p, pr} |
Products |
SELECT * FROM Production.Product AS p INNER JOIN Production.ProductReview AS |
from p in Products join pr in ProductReviews on p.ProductID select new {p, pr} |
Products |
SELECT * FROM Production.Product AS p INNER JOIN Production.ProductCostHistory |
from p in Products join pch in ProductCostHistories on new select new {p, pch} |
Products |
SELECT * FROM Production.Product AS p LEFT OUTER JOIN Production.ProductReview |
from p in Products join pr in ProductReviews on p.ProductID into prodrev select new {p, prodrev} |
Products |
SELECT p.ProductID AS ID FROM Production.Product AS p UNION SELECT pr.ProductReviewID FROM Production.ProductReview AS pr |
(from p in Products select new {ID = p.ProductID}).Union( from pr in ProductReviews select new {ID = pr.ProductReviewID}) |
Products |
SELECT TOP (10) * FROM Production.Product AS p WHERE p.StandardCost < 100 |
(from p in Products where p.StandardCost < 100 select p).Take(10) |
Products |
SELECT * FROM [Production].[Product] AS p WHERE p.ProductID IN( SELECT FROM WHERE ) |
from p in Products where (from pr in ProductReviews where pr.Rating == 5 select select p |
Products |
SQL-LINQ-Lambda语法对照的更多相关文章
- SQL,LINQ,Lambda语法对照图(转载)
如果你熟悉SQL语句,当使用LINQ时,会有似曾相识的感觉.但又略有不同.下面是SQL和LINQ,Lambda语法对照图 SQL LINQ Lambda SELECT * FROM HumanReso ...
- SQL,Linq,Lambda之间的转换练习
1.查询Student表中的所有记录的Sname.Ssex和Class列. SQL:select sname,ssex,class from Students linq:from s in Stude ...
- sql linq lambda 对比
. 查询Student表中的所有记录的Sname.Ssex和Class列. select sname,ssex,class from student Linq: from s in Students ...
- SQL-LINQ-Lambda 语法对照
SQL LINQ Lambda SELECT *FROM Employees from e in Employees select e Employees .Select (e => e) ...
- SQL/LINQ/Lamda 写法[转发]
SQL LINQ Lambda SELECT * FROM HumanResources.Employee from e in Employees select e Employees .Sele ...
- SQL Linq lamda区别
SQL LINQ Lambda SELECT * FROM HumanResources.Employee from e in Employees select e Employees .Sele ...
- SQL/LINQ/Lamda
SQL LINQ Lambda SELECT * FROM HumanResources.Employee from e in Employees select e Employees .Sele ...
- SQL-LINQ-Lambda语法对照,好记性不如烂笔头
忘记的时候就翻阅翻阅吧~~ SQL LINQ Lambda SELECT *FROM HumanResources.Employee from e in Employees select e Empl ...
- LINQ之路 4:LINQ方法语法
书写LINQ查询时又两种语法可供选择:方法语法(Fluent Syntax)和查询语法(Query Expression). LINQ方法语法是非常灵活和重要的,我们在这里将描述使用链接查询运算符的方 ...
随机推荐
- 逻辑回归:使用SGD(Stochastic Gradient Descent)进行大规模机器学习
Mahout学习算法训练模型 mahout提供了许多分类算法,但许多被设计来处理非常大的数据集,因此可能会有点麻烦.另一方面,有些很容易上手,因为,虽然依然可扩展性,它们具有低开销小的数据集.这样一个 ...
- UVA 11825 Hackers’ Crackdown(集合动态规划 子集枚举)
Hackers’ Crackdown Miracle Corporations has a number of system services running in a distributed com ...
- php日期处理
$datetime=strtotime(date("Y-m-d",time()));//获取当前日期并转换成时间戳 $datetime=$datetime+86400;//在时间戳 ...
- 深入了解jquery中的键盘事件
很多时候,我们需要获取用户的键盘事件,下面就一起来看看jquery是如何操作键盘事件的. 一.首先需要知道的是: 1.keydown() keydown事件会在键盘按下时触发. 2.keyup() k ...
- jQuery 源码细读 -- $.Callbacks
$.Callbacks 是 jQuery 提供的可以方便地处理各种回调(callback)列表的类,其源代码是闭包的经典实现. 基本原理就是通过在闭包环境内保存一个 list = [] 数组用于存储回 ...
- jsp 页面通过jq处理默认 选中的项 数据是通过遍历显示
jsp页面循环显示里面是<a></a>或者<input> id 以什么开头的id,然后当你点击那个的时候就在那个上面添加样式 <div> <di ...
- Svn与Git的区别
把第一条理解到位思想到位了做起来才会有的放矢,其他几条都是用的时候才能体会到 1) 最核心的区别Git是分布式的,而Svn不是分布的.能理解这点,上手会很容易,声明一点Git并不是目前唯一的分布式版本 ...
- http://src.chromium.org/svn/ 定制chrome浏览器教程及源码
chromium 官网登不进去,最近在学习chrome插件制作,网上教程很多大多没有源码 其实作为开源软件 官方提供了全部源码地址:http://src.chromium.org/svn/ PRESU ...
- 为何要fork()两次来避免产生僵尸进程??
最近安装书上说的,开始搞多进程了..看到了一个好帖子,学习学习 http://blog.sina.com.cn/s/blog_9f1496990100y420.html 首先我们要明白,为什么要避免僵 ...
- 关于Keil的安装与注册
由于前一段时间一直在做关于stm32f407的相关内容,于是安装的Keil是MDK5,最近一阵子想再看看51单片机以前没有做过的内容,就要再安装一个Keil C51,结果就不可避免的遇到了两个软件必须 ...