Reporting Elements | SQL Interview joins based scenario question
You must provide a report of all distributors and their sales by region. If a distributor did not have any sales for a region, provide a zero-dollar value for that day. Assume there is at least one sale for each region.
DML Script:
DROP TABLE IF EXISTS RegionSales;
GO
CREATE TABLE RegionSales
(
Region VARCHAR(100),
Distributor VARCHAR(100),
Sales INTEGER NOT NULL
);
GO
INSERT INTO RegionSales (Region, Distributor, Sales) VALUES
('North','ACE',10),
('South','ACE',67),
('East','ACE',54),
('North','ACME',65),
('South','ACME',9),
('East','ACME',1),
('West','ACME',7),
('North','Direct Parts',8),
('South','Direct Parts',7),
('West','Direct Parts',12);
GO
SElect * FROM RegionSales
Detailed Explanation: https://youtu.be/9wyqnTklfCs
Comments
Post a Comment