当前位置:网站首页>SQL基本语句 DQL select与提取 DML插入删除
SQL基本语句 DQL select与提取 DML插入删除
2022-07-25 22:06:00 【不惭_】
SQL语句大体分为四类:
1) DDL:数据定义语言,创建、删除、修改数据库、数据表的。
2) DML:数据管理语言,对数据表中的数据进行增加、删除、修改操作。
3) DQL:数据查询语言,对数据表中的数据进行查询操作。
4) DCL:数据控制语言,对数据库的权限、角色等进行操作。
这里首先写一下DQL语句
简单查询
最简单的select
select 字段列表 from 表名
字段与表改名
select 字段名 as 别名, 字段名 as 别名 from 表名 as 别名
where
对查询记录进行筛选。只有符合筛选条件的记录,才会出现在查询结果中。
1) 比较运算符
运算符 作用
“>” 大于
“>=” 大于等于
"<"小于
“<=” 小于等于
“=” 等于
“!=,<>” 不等于
null值不会参与比较运算
2) 逻辑运算符
运算符 作用
and 逻辑与
or 逻辑或
not 逻辑非
3) Null值的判断
运算符 作用
is null 字段为null
is not null 字段不为null
4) between…and…
判断范围,闭区间。
相当于 字段 >= 值 and 字段 <=值。
5) 模糊查询
字段 like '规则'
规则: %表示任意多个任意字符,_表示任意的一个字符。
SQL不区分大小写的,like,=都不区分大小写。
6) in
字段 in (值, 值, 值...)
字段 not in (值, 值, 值...)
分组查询
使用group by 在查询到的数据中,进行分组,指定字段相同的记录会被合并为一组。
group by 字段名, ...
group by 1, 2, ... // 字段的下标,从1开始
边栏推荐
- 若依如何解决导出使用下载插件出现异常?
- 磁盘空间的三种分配方式
- I/o case practice
- Preliminary study on Tesseract OCR
- jsp九大内置对象
- The testing work is not valued. Have you changed your position?
- 2年功能测试,却感觉自己什么都不会,2022我该何去何从?
- Nuclear power plants strive to maintain safety in the heat wave sweeping Europe
- The file cannot be saved (what if the folder is damaged and cannot be read)
- [MAIXPY]kpu: load error:2005, ERR_ READ_ File: read file failed problem solving
猜你喜欢

Share | intelligent fire emergency management platform solution (PDF attached)

Ansible+cronab batch deployment patrol

『SignalR』.NET使用 SignalR 进行实时通信初体验

成为比开发硬气的测试人,我都经历了什么?

Open source RSS subscriber freshrss

面了个腾讯三年经验的测试员,让我见识到了真正的测试天花板

TS:typora代码片段缩进显示异常(已解决)-2022.7.24

【汇编语言01】基础知识

2022 love analysis ― bank digitalization practice report

别投了,软件测试岗位饱和了...
随机推荐
Application of breakthrough thinking in testing work
6-18 vulnerability exploitation - backdoor connection
Redis usage details
Basic knowledge in the project
Why does redis choose single thread?
JS timer and swiper plug-in
mouseEvent事件——mouse坐标描述——focus事件——input事件——节流(thorttle)——mouseWheel(滚轮事件)
【饭谈】Web3.0到来后,测试人员该何去何从?(十条预言和建议)
[51Nod1676 无向图同构]无向图哈希[通俗易懂]
C language: random generated number + bubble sort
zigbee开发板(nxpzigbee开发)
8000 word super detailed custom structure type
Can I buy financial products with a revenue of more than 6% after opening an account
Guiding principles of information security construction
若依如何解决导出使用下载插件出现异常?
How to use RS485 half duplex chip correctly
Golang: MVC models
【汇编语言01】基础知识
磁盘空间的三种分配方式
Create files, file permissions, ownership, and sticky bits