sql运算符

AND is used in a WHERE clause or a GROUP BY HAVING clause to limit the rows returned from the executed statement. Use AND when it’s required to have more than one condition met.

在WHERE子句或GROUP BY HAVING子句中使用AND来限制从已执行语句返回的行。 当需要满足多个条件时,请使用AND。

We’ll use the student table to present examples.

我们将使用学生表展示示例。

Here’s the student table without a WHERE clause:

这是不带WHERE子句的学生表:

select * from student;

Now the WHERE clause is added to display only programming students:

现在,添加了WHERE子句以仅显示编程学生:

select * from student
where programOfStudy = 'Programming';

Now the WHERE clause is updated with AND to show results for programming students that also have a SAT score greater than 800:

现在,WHERE子句使用AND更新,以显示对SAT分数也大于800的编程学生的结果:

select * from student
where programOfStudy = 'Programming'
and sat_score > 800;

This is a more complex example from the campaign contributions table. This example has a GROUP BY clause with HAVING clause using an AND to restrict the returned records to candidates from 2016 with contributions between $3 Million and $18 Million in total.

这是广告系列贡献表中更复杂的示例。 此示例具有GROUP BY子句和HAVING子句,并使用AND来将返回的记录限制为2016年以来的候选者,贡献总额在300万美元至1800万美元之间。

select Candidate, Office_Sought, Election_Year, FORMAT(sum(Total_$),2) from combined_party_data
where Office_Sought = 'PRESIDENT / VICE PRESIDENT'
group by Candidate, Office_Sought, Election_Yearhaving Election_Year = 2016 and sum(Total_$) between 3000000 and 18000000
order by sum(Total_$) desc;

翻译自: https://www.freecodecamp.org/news/the-sql-and-operator-explained-examples/

sql运算符

sql运算符_SQL AND运算符解释语法示例相关推荐

  1. sql运算符_SQL LIKE运算符概述

    sql运算符 In this article, we are going to learn how to use the SQL LIKE operator, in SQL Server, using ...

  2. sql算术运算符_SQL运算符教程–按位,比较,算术和逻辑运算符查询示例

    sql算术运算符 At its core, the internet and all its applications are just data. 互联网及其所有应用程序的核心只是数据. Every ...

  3. sql运算符_SQL运算符

    sql运算符 SQL Operators are a series of characters, symbols and words which are used as part of the WHE ...

  4. sql判断整除_SQL操作符/运算符

    SQL里的操作符,也有人叫它运算符. 操作符/运算符大多用于在SELECT命令的WHERE字句中,表示表达式与其他元素之间的特定算数或逻辑关系,为返回的数据指定更明确的条件.SQL里有多种操作符,能满 ...

  5. sql 运算符_了解SQL ANY和ALL运算符

    sql 运算符 Hello, folks! Hope you all are doing well. In this article, we will be discussing about SQL ...

  6. SQL Server里PIVOT运算符的”红颜祸水“

    概述 SQL Server里PIVOT运算符背后的基本思想是在T-SQL查询期间,你可以旋转行为列.运算符本身是SQL Server 2005后引入的,主要用在基于建立在实体属性值模型(Entity ...

  7. sql while循环_SQL WHILE循环的简单示例

    sql while循环 SQL WHILE loop provides us with the advantage to execute the SQL statement(s) repeatedly ...

  8. Oracle PL/SQL 第三章--运算符与表达式

    Oracle PL/SQL 第三章--运算符与表达式 目录 Oracle PL/SQL 第三章--运算符与表达式 1.运算符分类 1.1.算术运算符 1.2.关系运算符 1.3.比较运算符 1.4.逻 ...

  9. sql limit 子句_SQL按子句概述和示例

    sql limit 子句 This article will cover the SQL ORDER BY clause including syntax, usage scenarios to so ...

最新文章

  1. spring boot配置文件:application.yml (yml与properties文件优缺对比)
  2. 28款网页CSS设计工具和生成器
  3. linux 串口控制read()的说明
  4. 信息学奥赛一本通C++语言——1083:计算星期几
  5. Android进阶:自定义视频播放器开发(下)
  6. 二值化区分前景和背景
  7. 遗传算法小结及算法实例(附Matlab代码)
  8. 什么是JavaWeb,主要框架有哪些
  9. 网页聊天室php无数据库_无需数据库的PHP聊天室程序
  10. 【C++】STL学习小总结
  11. 关于easyx库中怎样贴出透明图片
  12. 组播IGMP 自学笔记
  13. 各地2022年上半年软考考试疫情防控要求汇总-2022-05更新
  14. 微微一笑很倾城 从网红浅看CRM发展趋势
  15. 小米8绑定账号和设备验证失败_不要浪费小米10的双扬声器!杜比全景音刷入教程分享...
  16. 短信验证码测试——短信轰炸之横向轰炸和纵向轰炸
  17. java哪个软件编程好学吗_java是什么软件好学吗(java编程用哪个软件)
  18. 查看IC卡芯片的位置
  19. jquery简单赋值取值
  20. 常见电路、元器件汇总

热门文章

  1. Linux—目录文件属性和权限管理详解
  2. git-工作区与暂存区
  3. linux-数据库篇-索引
  4. BZOJ3236[Ahoi2013]作业——莫队+树状数组/莫队+分块
  5. CentOS 下安装 Node.js 8.11.3 LTS Version
  6. 【剑指offer】二叉搜索树转双向链表,C++实现
  7. FutureV接口CallableV接口的使用
  8. 导致Oracle性能抖动的参数提醒
  9. Oracle corrupt block(坏块) 详解
  10. Android学习之Image操作及时间日期选择器