当前位置:网站首页>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
注释
- – 两个连字符
- /* */ 多用于多行注释
边栏推荐
- SQL Basics
- 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
- 如何让主线程等待子线程执行完毕后再执行
- 遇到女司机业余开滴滴,日入500!
- js-下载图片
- Gof23 - abstract factory pattern
- 浏览器的四大内核:Trident,Gecko,Webkit,Blink
- Go language learning notes 1.2- variables
- Pytorch uses multi GPU parallel training and its principle and precautions
- [micro service series] protocol buffer dynamic analysis
猜你喜欢

Gof23 - prototype mode

宝塔服务器搭建及数据库远程连接

营销技巧:相比较讲产品的优点,更有效的是要向客户展示使用效果

How to set MySQL triggers is a simple tutorial for novices

【golang】time相关

LabVIEW Arduino TCP/IP远程智能家居系统(项目篇—5)

Number of connections server database message: error number 2003can't connect to MySQL server on 'server address' (10061)

LabVIEW Arduino tcp/ip remote smart home system (project part-5)

MySQL

分析 NFT 项目的 5 个指标
随机推荐
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
Marketing skills: compared with the advantages of the product, it is more effective to show the use effect to customers
Temperature alarm
屏幕共享推荐
Simple use of enum type in TS
SQL中空值的判断
C nuget offline cache package installation
MYSQL索引不生效的原因
Go语言学习笔记 1.1
Decision tree learning notes
~94 zoom
The sysdig 2022 cloud native security and usage report found that more than 75% of the running containers have serious vulnerabilities
JS download pictures
I use flask to write the website "II"
LabVIEW arduino TCP / IP Remote Intelligent Home System (Project section - 5)
MYSQL(三)
My SQL(二)
分析 NFT 项目的 5 个指标
How to set MySQL triggers is a simple tutorial for novices
What is data mining?