惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
Jina AI
Jina AI
H
Help Net Security
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
L
LangChain Blog
Recorded Future
Recorded Future
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
GbyAI
GbyAI
B
Blog RSS Feed
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
M
MIT News - Artificial intelligence
爱范儿
爱范儿
V
V2EX
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Y
Y Combinator Blog
B
Blog
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
W
WeLiveSecurity
MongoDB | Blog
MongoDB | Blog
Cloudbric
Cloudbric
N
News and Events Feed by Topic
The Cloudflare Blog
月光博客
月光博客
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
D
DataBreaches.Net
博客园 - 【当耐特】
T
Troy Hunt's Blog
V
Visual Studio Blog
V2EX - 技术
V2EX - 技术
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google Online Security Blog
Google Online Security Blog
The GitHub Blog
The GitHub Blog

博客园 - 木饭

码农必读的 7 本计算机书 我已经三十多岁了,我该把时间投资在哪呢? SQL SERVER 2012 第五章 创建和修改数据表 の CREATE语句 SQL SERVER 2012 第五章 创建和修改数据表 の SQL SERVER中的对象名 SQL SERVER 2012 第四章 连接 JOIN语句的早期语法结构 & 联合UNION SQL SERVER 2012 第四章 连接 JOIN の OUTER JOIN,完全连接FULL JOIN,交叉连接CROSS JOIN C#高级编程第9版 第二章 核心C# 读后笔记 SQL SERVER 2012 第四章 连接 JOIN の INNER JOIN SQL SERVER 2012 第三章 使用INSERT语句添加数据 SQL SERVER 2012 第三章 T-SQL 基本语句 having子句 SQL SERVER 2012 第三章 T-SQL 基本语句 group by 聚合函数 C#高级编程第9版 第一章 .NET体系结构 读后笔记 无法打开物理文件 "X.mdf"。操作系统错误 5:"5(拒绝访问。)"。 (Microsoft SQL Server,错误: 5120)解决 MVC view页面需要多个model,复杂网页的处理 中国福利彩票,牛B,开奖和数据传输有什么关系? Mvcpager以下各节已定义,但尚未为布局页“~/Views/Shared/_Layout.cshtml”呈现:“Scripts”。 骆驼男鞋怎么样,骆驼男鞋售后逆天,骆驼男鞋维修36天无结果。程序员屌丝的维权之路,直播。。。。。。 IOS7状态栏StatusBar官方标准适配方法 iphone原生cookie处理
SQL SERVER 2012 第三章 T-SQL 基本SELECT语句用法,Where子句详细用法
木饭 · 2015-02-12 · via 博客园 - 木饭

select [all|distinct] [top (<expression>) [Percent] [with ties]] <column list>

[from <source table(s)/views>]

[where <restrictive condition>]

[group by <column name or expression using a column in the select list>]

[having <restrictive condition based on the group by results>]

[order by <column list>]

[[for xml {raw|auto|explicit|path [(<element>)]} [,xmldata] [,ELEMENTS] [,BINARY BASE 64] ]]

[OPTION (<QUERY HINT>,[,...N])]

上述语法结构非常复杂,一点一点逐步解析开。

基本的:

SELECT 列名称 FROM 表名称;

加上where子句后,变为:SELECT 列名称 FROM 表名称 WHERE 条件

这里详细的体现一下where子句的详细用法,如下:

运算符 示例用法 功能
=、>、<、>=、<=、<>、!=、!>、!< <column> = 'Bob' 在区分大小写的情况下,"ROMEY" <> "romey"。!=和<>都表示"不相等",!<、!>表示"不小于"和"不大于"
and、 or 、not <column1> = <column2> and
<column3> = <column4>
在语句中运算的顺序是not、and、or。如果要改变顺序可以用小括号。
 between  <column> between 1 and 5 第一个值在第二个值与第三个值之间时其值为true,其等价于A>=B AND A<=C。
指定的值可以为列名、变量或字面量。 
 like  <column> like "ROM%" 可使用%和_作为通配符。%表示可以代替任意长度的字符串。_表示可以代替任意的单个字符。[]符号用于指定
一个字符、字符串或范围,要求所匹配对象为他们中的任一个(如[a-c]表示a、b和c。而[ab]表示a或b)。^ 运算
符的作用与NOT运算符相同,表示下一个字符是要被排除的。
 in  <column> in ("a","b","345") 关键字in左边的表达式与其右边的任意值匹配时返回true。in常用于子查询。 
 all、any、some  <column|expression>
(比较运算符)
<ANY|SOME>(子查询)
子查询中全部值/任意值满足比较运算符(如<、>、=、>=)的条件时返回true。ALL指示表达式要匹配的 
结果集中的所有值。any和some功能相似,在表达式匹配结果集中的任意值时返回true。
 exists  exists(子查询) 子查询返回至少一行记录时为true。