Sapling received access to a client database. The client is a paint and paint supplies distributor, and
Fantastic news! We've Found the answer you've been seeking!
Question:
- Sapling received access to a client database. The client is a paint and paint supplies distributor, and they record all their sales transactions in a "live_sales" table, holding information on sales line items and their respective brand, price, quantities, discounts, etc. Could you describe what the following SQL query does?
SELECT
Brand,
YEAR(date_datetype),
MONTH(date_datetype),
SUM(amount) AS GrossSales,
SUM(lineitemdiscount) AS Discount,
(COALESCE(SUM(amount), 0) + COALESCE(SUM(lineitemdiscount), 0)) AS NetSales,
SUM(est_extended_cost) AS Cost,
(COALESCE(SUM(amount), 0) + COALESCE(SUM(lineitemdiscount), 0) - COALESCE(SUM(est_extended_cost), 0)) AS GrossMargin,
SUM(quantity) AS Volume
FROM
live_sales
GROUP BYBrand , YEAR(date_datetype) , MONTH(date_datetype);
Related Book For
Accounting Information Systems basic concepts and current issues
ISBN: 978-0078025334
3rd edition
Authors: Robert Hurt
Posted Date: