bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1543. Fix Product Name Format

1543. Fix Product Name Format

Leetcode Solutions

Grouping and Formatting Sales Data

  1. Use LOWER() to convert product_name to lowercase.
  2. Use TRIM() to remove leading and trailing whitespace from product_name.
  3. Use DATE_FORMAT() to convert sale_date to the 'YYYY-MM' format.
  4. Group the results by the cleaned product_name and formatted sale_date.
  5. Use COUNT() to calculate the total number of sales for each group.
  6. Order the final result by product_name and sale_date in ascending order.

erDiagram
    Sales {
        int sale_id PK
        varchar product_name
        date sale_date
    }

Nothing

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...