数据库查询语言
1.全查询
select * from 表名;
2.过滤查询
select distinct 列名 from 表名 ;
3.连接查询
select concat(列1,列2,...)as 重命名 from 表名;
带分隔符
select concat_ws('_',列1,列2,...) as 重命名 from 表名;
4.模糊查询
select 列 from 表 where 列 like '%字符串%';
5. 排列
select * from 表 order by 列 ASC(默认,小到大) /DESC(大到小)
6.聚合函数
select count(*) from 表 统计数目
select sum(列) from 表
select avg(列) from 表
max
min
。。。
7.分组查询
select 列1,列2.。。 from 表 group by 列;
带条件的
select 列 from 表 group by 列 having 筛选条件
8.连接查询
select 列1,列2 from 表1 inner(left,right) join 表2 on 表1.列 = 表2.列
9.联合查询
select 列1 from 表1 union all select 列2 from 表2