1148.文章浏览I
题目链接:1148.文章浏览I
解答
# Write your MySQL query statement below
select distinct author_id as id
from Views
where author_id=viewer_id
order by id;
1179.重新格式化部门表
题目链接:1179.重新格式化部门表
解答
# Write your MySQL query statement below
select id,
sum(case when month='Jan' then revenue end) Jan_Revenue,
sum(case when month='Feb' then revenue end) Feb_Revenue,
sum(case when month='Mar' then revenue end) Mar_Revenue,
sum(case when month='Apr' then revenue end) Apr_Revenue,
sum(case when month='May' then revenue end) May_Revenue,
sum(case when month='Jun' then revenue end) Jun_Revenue,
sum(case when month='Jul' then revenue end) Jul_Revenue,
sum(case when month='Aug' then revenue end) Aug_Revenue,
sum(case when month='Sep' then revenue end) Sep_Revenue,
sum(case when month='Oct' then revenue end) Oct_Revenue,
sum(case when month='Nov' then revenue end) Nov_Revenue,
sum(case when month='Dec' then revenue end) Dec_Revenue
from Department group by id order by id;
最后,我写了一篇MySQL教程,里面详细的介绍了MySQL的基本概念以及操作指令等内容,欢迎阅读!
MySQL数据库万字保姆级教程