avg() |
Return numeric columns平均值 |
select avg(column_name ) from table_name |
between() |
Select 两个 the data range between the values, the value can be数值文本或者日期 |
select column_name from table_name where between value1 and value1 |
ceiling() |
向上舍入 Specify the number of decimal places |
ceiling(numerical ,decimal place ) |
concat |
Will be 多个字符串 connected to一个字符串 |
concat(str1 , str2 ,…) |
concat_ws |
And the concat same, will be 多个字符串 connected 一个字符串 , but you can指定分隔符 |
concat_ws(separator , str1 , str2 , …) |
Count(column_name) |
Of the returned 指定列 value 数目 ,NULL 值除外 |
select Count(column_name ) from table_name |
Count(*) |
Back in the table 记录数 ,包括 NULL 值 |
select Count(*) from table_name |
Count(distict column_name) |
Returns 不同值 the number of the specified column |
select Count(distict column_name ) from table_name |
cast() |
Convert some kind 数据类型 of 表达式 explicit to另一种数据类型 |
select cast(expression as data_type ) |
floor() |
向下舍入 Specify the number of decimal places |
floor(numerical ,decimal place ) |
format() |
For 字段 the 显示 conduct格式化 |
select format(column_name ,format ) from table_name |
group by |
According to the 一个或多个列对 result set进行分组 |
select group_concat(column_name ,column_name ) from table_name group by table_name |
where |
Extracting those 满足指定条件 of记录 |
select column_name from table_name where column_name operator value |
if() |
条件判断 Statement |
if(condition ,Tlue ,False ) |
limit |
Used for 限制 query result return数量 |
select * from table_name limit index ,quantity |
lengh |
Obtain字符串长度 |
select lengh() |
lcase() |
Convert 字段 the value to小写 |
select lcase(column_name ) from table_name |
mid() |
From 文本字段 the提取字符 |
select mid(column_name ,start ,[length ]) from table_name |
min () |
Returns the specified column最小值 |
select min(column_name ) from table_name |
max() |
Returns the specified column最大值 |
select max(column_name ) from table_name |
round() |
四舍五入 Convert the original value to the specified number of decimal places |
round(numerical ,decimal place ) |
Rand() |
随机函数 A random 0到1 number |
select Rand() |
select |
From 数据库 selecting the数据 |
select 数据名 from 数据库名 |
select disstinct |
Used to return唯一不同的值 |
select disstinct column_name ,column_name from table_name |
show |
List 数据库系统 all数据库 |
show databases or tables |
substr |
String interception内容 |
substr(str ,start ,end ) |
Sum() |
Return numeric columns总数 |
select Sum(column_name ) from table_name |
Sleep() |
休眠 |
select slepp ( time ) |
top() |
For 规定 the record to be returned数目 |
select top (numerical * ) or (numerical percent) from name |
use |
Change current operation数据库 |
use 数据库名 |
ucase() |
Convert 字段 the value to大写 |
select ucase(column_name ) from table_name |
union |
Merged 两个 or 多个 SELECT 语句 result |
select column_name ,… from table_name union select ..... |
union all |
Allowable on the basis of union选取重复的值 |
select column_name ,… from table_name union all select ..... |