Write an SQL query to find for each date the number of different products sold and their names.
The sold products names for each date should be sorted lexicographically.
Return the result table ordered by sell_date
.
The query result format is in the following example.
GROUP BY
로 그룹화 한 데이터 확인시SELECT GROUP_CONCAT(COL2)
FROM 테이블명
GROUP BY COL1
SELECT GROUP_CONCAT(COL2 ORDER BY COL2 DESC)
FROM 테이블명
GROUP BY COL1
SELECT GROUP_CONCAT(DISTINCT COL2)
FROM 테이블명
GROUP BY COL1
GROUP BY
사용COUNT()
사용DISTINCT
조건 추가GROUP_CONCAT
사용DISTINCT
조건 추가ORDER BY
정렬SELECT sell_date
, COUNT(DISTINCT product) num_sold
, GROUP_CONCAT(DISTINCT product ORDER BY product) products
FROM activities
GROUP BY sell_date