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 displays sales of concert tickets.


CREATE TABLE tickets
(TicketID int identity(1,1),
PurchaseDatedatetime,
TicketDesc varchar(150),
TicketPrice int)
GO

  • As shown in the table, from 9:00 to 10:00 two tickets were successively sold to an Adel concert, and then to a Kanye West concert, and then another ticket to Adel, and then another one to Kanye West.
  • As you can also see, from 10:00 to 11:00 three tickets were successively sold to an Adel concert, and then to a Kanye West concert, and then another ticket to Adel.

Would you like to read more?