mysql查询语句

本文介绍了MySQL中常用的查询语句,包括数值型、字符串、日期型等数据类型的查询方式,以及逻辑运算符的使用、非空数据查询、限定查询结果数量的方法等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

mysql常用查询语句大全
1.查询数值型数据:select * from table where sum>100
查询谓词:< = > <> != !> !< =< =>
2.查询字符串:select * from table where sname= % % %%
3.查询日期型数据:select * from table where date ="2011-10-10"
4.查询逻辑型数据:select * from table where type='T' 'F'逻辑运算符and not or
5.查询非空数据:select * from table where address <> '' order by add desc <>不等于
6.查询前n条数据:select * from table order by desc limit m,n
7.指定时间段:select * from table where id between and
8.按月查询:month(day) year() day()
9.查询结果不显示重复:select distinct 字段 from 表 where 条件
10.not与谓词进行组合:not in ,not between and ,is not null,is null
11.重复的记录数select count(*) group by
12.升降序:order by desc asc
13.多条件查询排序
14.多表查询
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值