This advanced SQL exercise is part of the book: Advanced SQL – Practical Techniques and Use-Cases, which includes 100 day-to-day SQL challenges (and solutions), need-to-know advanced features, and key concepts.
 

Given a table that represents sales made in a certain chain store. Each row displays the sale number, sale date, the department where that sale was made, and the sale’s amount.


CREATE TABLE sales
(saleID int identity(1,1),
saleDate date,
department varchar(125),
amount int )
GO

Would you like to read more?