当前位置:网站首页>SQL 查询语句
SQL 查询语句
2022-06-26 06:42:00 【我的天才女友】
基本查询
- 指定字段
select 字段A,字段B from 表
- 查询全部字段
select * from 表
查询数据过滤
- 简单过滤
| 运算符 | 例子 |
|---|---|
| = | id = 1 |
| != 或<> | sex != 1 |
| >= 、> 、<、<= | salary > 1000 |
| BETERRN | salary between 100 and 200 |
| IN | name IN(‘爱惜’,‘蛮子’) |
- 空值判断
select * from user where name is null
- 文本模糊
使用like匹配,% 匹配0或者多个字符,_匹配一个字符
select * from user where name like '%i'
- 组合逻辑
AND OR NOT - 去重
DISTINCT
排序
order by –
ASC:升序(默认)
DESC:降序
限定结果集
这里是mysql的语句写法,limit 指定数量,offset指定从哪个位置开始,也就是偏移量,默认是从0开始
select 字段 from 表名 order by 字段 limit a offset b
注释
- – 两个连字符
- /* */ 多用于多行注释
边栏推荐
- STM 32 使用cube 生成TIM触发ADC并通过DMA传输的问题
- Laravel implements groupby to query the number of packets
- 营销技巧:相比较讲产品的优点,更有效的是要向客户展示使用效果
- Dpdk - tcp/udp protocol stack server implementation (II)
- 如何让主线程等待子线程执行完毕后再执行
- 解决新版谷歌Chrome浏览器Cookie跨域失效问题
- Spark3.3.0 source code compilation supplement - Crazy certificate problem
- Pytorch uses multi GPU parallel training and its principle and precautions
- Installing rainbow in various kubernetes with Helm
- 数据湖架构之Hudi编译篇
猜你喜欢

淺析一道經典題

Phantom star VR equipment product details II: dark battlefield

Go语言学习笔记 1.1

浅析一道经典题

When vs code uses prettier to format JS, there is a space between the name of the function definition and the parentheses, and ESLIt does not allow this space

I caught a 10-year-old Alibaba test developer in the company. After chatting with him, I realized everything

Decompile Android applications, interview Android
Experience the new features of Milvus 2.0 together
![[digital signal processing] basic sequence (unit step sequence | relationship between unit step sequence and unit pulse sequence | rectangular sequence | relationship between rectangular sequence and](/img/0c/3aeb7f93576181bbc46d2d1a1aa0e7.jpg)
[digital signal processing] basic sequence (unit step sequence | relationship between unit step sequence and unit pulse sequence | rectangular sequence | relationship between rectangular sequence and

数据湖架构之Hudi编译篇
随机推荐
Container with the most water
Kotlin compose state recovery remembersaveable and remember
Custom reference formats used by Zotero
MySQL delete in without index
On a classical problem
Lightgbm-- parameter adjustment notes
Past events of Xinhua III
I use flask to write the website "II"
Judgment of SQL null value
Kotlin Compose 状态恢复 rememberSaveable 与 remember
Closure problem C Lua
Hudi compilation of data Lake architecture
Get the first and last days of the current month, and the first and last days of the previous month
Play with a variety of application scenarios and share secrets with Kwai MMU
浅析一道经典题
LightGBM--调参笔记
【yolov4】基于yolov4深度学习网络目标检测MATLAB仿真
Number of connections server database message: error number 2003can't connect to MySQL server on 'server address' (10061)
typescript的type
如何把数据库的数据传给复选框