Table: Sales
| Column Name | Data Type |
|---|---|
| sale_id | INT |
| product_name | VARCHAR |
| sale_date | DATE |
Since table Sales was filled manually in the year 2000, product_name may contain leading and/or trailing white spaces, also they are case-insensitive.
Write an SQL query to report
The query result format is in the following example.
Sales
+---------+--------------+------------+
| sale_id | product_name | sale_date |
+---------+--------------+------------+
| 1 | LCPHONE | 2000-01-16 |
| 2 | LCPhone | 2000-01-17 |
| 3 | LcPhOnE | 2000-02-18 |
| 4 | LCKeyCHAiN | 2000-02-19 |
| 5 | LCKeyChain | 2000-02-28 |
| 6 | Matryoshka | 2000-03-31 |
+---------+--------------+------------+
Result table:
+--------------+-----------+-------+
| product_name | sale_date | total |
+--------------+-----------+-------+
| lckeychain | 2000-02 | 2 |
| lcphone | 2000-01 | 2 |
| lcphone | 2000-02 | 1 |
| matryoshka | 2000-03 | 1 |
+--------------+-----------+-------+