MySQL之DQL(查询表中的记录)
发布于 2021-10-14 09:30
Select
字段列表
From
表名列表
Where
条件列表
Group by
分组字段
Having
分组之后的条件
Order by
排序
Limit
分页限定
Select 字段名1,字段名2,… from 表名;
注意:如果查询所有字段,则可以使用*来替代字段的列表

Distinct 去除重复

一般可以使用四则运算计算一些列的值。(一般只会进行数值型的计算)
ifnull(表达式1,表达式2);-- null参与的运算,计算结果都为null

as:as也可以省略

<、 <=、 >=、 =、 <>
BETWEEN...AND
IN(集合)
LIKE '张%'
占位符:
_:单个任意字符
多个任意字符 :
IS NULL
and 或 &&
or 或 ||
not 或 !

查询年龄大于20岁
Select * from student where age > 20;
查询年龄大于等于20岁
Select * from student where age >= 20;
查询年龄等于20岁
Select * from student where age = 20;


本文来自网络或网友投稿,如有侵犯您的权益,请发邮件至:aisoutu@outlook.com 我们将第一时间删除。
相关素材