导图社区 MySQL
这是一篇关于MySQL的思维导图,其内容包含SELECT语句,where从句以及利用grouo by函数进行分组等知识点
社区模板帮助中心,点此进入>>
英文雅思大作文的命题类型和写作框架总结!
G类小作文书信写法
六级高频单词
英语学习p字母相关的单词
系动词be的语法
48个国际音标标准学习
topic
雅思听力临考前策略
学习类-英语四级基础语法 思维导图
The Allende Meteorite
MySQL
SELECT语句
select * from 表名 select--选择语句 *--查询表中所有数据
筛选核心维度:select 字段名 from 表名; select month,year from sales;
where语句
多条件筛选并列:where 条件1 and 条件2 select *from sales where year=2019 and month=2;
多条件筛选(或者):where 条件1 or 条件2 select *from sales where year=2019 and year=2020;
范围筛选(非连续):where ... in ... select *from sales where year in(2019,2020);
范围筛选(连续):where ... between ... select *from sales where month between 1 and 7;
语句集合!一次查清问题所需数据 select*from sales where year in (2019,2020)and (month between 1and 7);
利用sum() 函数查询销售额 select sum(price) from sales where year in (2019,2020)and (month between 1and 7);
利用group by函数进行分组 select sum(price) from sales where year in (2019,2020)and(month between 1 and 7) group by year;
利用order by函数进行分组 select sum(price) from sales where year in (2019,2020)and(month between 1 and 7) group by year order by year;
综合运用select where group by语句进行业务分析
select year,sum(price) from sales where year in (2019,2020)and (month between 1 and 7) group by year;
按年份降序 加一个desc