Sobes.tech
Intern — Middle

Sales summary report by departments and months

livecode

Task condition

There is a SALES table with the following fields:

  • id — unique record identifier
  • dept_id — department number
  • date — date of sale
  • sale_amt — sale amount

It is necessary to generate an aggregated report, grouping data by department and month of sale. The result should display:

  • dept_id (department number),
  • month of sale (excluding the year),
  • total sales amount for the month,
  • number of sales made.

To get the month number from the date, use the function MONTH(date).

SELECT ...
FROM SALES
GROUP BY ...