---
title: "mysql查询语句"
author: "bor1"
date: "2015-09-11T02:12:20Z"
tags: []
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2015-09-11T02:12:20Z"
id: 2242556
url: "https://bor1.iteye.com/blog/2242556"
---

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.多表查询