3. 按照艺人统计每个艺人每天所有歌曲的播放量,输出文件为exp2_3.csv,各个列名为艺人id,日期Ds, 歌曲播放总量。注意:这里只统计歌曲的播放量,不包括下载和收藏的数量。
时间: 2023-05-26 21:03:25 浏览: 139
记录歌曲播放时间
SELECT
ar.id AS '艺人id',
ds AS '日期Ds',
SUM(playcnt) AS '歌曲播放总量'
FROM
music_info mi
JOIN artist ar ON mi.artist_id = ar.id
WHERE
ds BETWEEN '2022-01-01' AND '2022-01-31'
GROUP BY
ar.id,
ds
ORDER BY
ar.id,
ds
INTO OUTFILE 'exp2_3.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
阅读全文