![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
【数据分析】
数据分析相关文章
理想主义的许佳佳
一位理想主义的程序员,祝你健康幸福。
展开
-
sql学习-with as的使用-分析数据得到结果
概述 当前有一张“学生成绩表” 需要查询男女的及格率。 例子 create table StudentScore ( name string, score int, sex string ); INSERT INTO StudentScore VALUES ('AAA',32,'man'), ('BBB',58,'man'), ('CCC',82,'man'), ('DDD',44,'woman'), ('EEE',92,'woman'); select查询 with as作用: 定义一个S原创 2022-03-13 17:11:26 · 1148 阅读 · 0 评论 -
SQL学习- case when then else
场景 当前有一张“学生成绩表” 需要查询有哪些学生及格,哪些不及格。 例子 create table StudentScore ( name string, score int ); INSERT INTO StudentScore VALUES ('AAA',32), ('BBB',58), ('CCC',62), ('DDD',92); select查询 select name, case when score >= 90 then '优秀' when score >= 60原创 2021-12-19 10:10:24 · 302 阅读 · 0 评论 -
SQL学习-alter-添加新的字段
概述 当开发者自己维护table时,经常会碰到更改表的结构的场景。 这时候就需要用到alter。 需要注意的是,在更改table的结构时,倘若是新增了字段,那么需要通过update来给新的字段赋值。 Demo create table Person ( name string, age int ); insert into Person values ("AAA",16), ("BBB",10), ("CCC",20); -- 插入新的字段 alter table Person add adult原创 2021-12-12 20:40:27 · 4322 阅读 · 0 评论 -
SQL学习-group by-多表分组场景
场景 当前有两张表: 商品售卖历史表、商品信息表 需要输出的结果: 当前售卖商品的数量汇总。 例子 CREATE TABLE SellCheck ( goods_id string, sell_number int ); INSERT INTO SellCheck VALUES ("111",3), ("222",6), ("111",4), ("111",5), ("222",2); CREATE TABLE GoodsList ( id string, name string ); INSER原创 2021-12-05 16:27:27 · 838 阅读 · 0 评论