Advertisement
dragonbs

Show All Games with Duration & Part of the Day

Sep 25th, 2023
1,297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.51 KB | None | 0 0
  1. SELECT [Name] AS [Game],
  2.        (CASE
  3.             WHEN DATEPART(HOUR, [Start]) BETWEEN 0 AND 11 THEN 'Morning'
  4.             WHEN DATEPART(HOUR, [Start]) BETWEEN 12 AND 17 THEN 'Afternoon'
  5.             WHEN DATEPART(HOUR, [Start]) BETWEEN 18 AND 23 THEN 'Evening'
  6.         END) AS [Part of The Day],
  7.         (CASE
  8.             WHEN [Duration] BETWEEN 0 AND 3 THEN 'Extra Short'
  9.             WHEN [Duration] BETWEEN 4 AND 6 THEN 'Short'
  10.             WHEN [Duration] > 6 THEN 'Long'
  11.             ELSE 'Extra Long'
  12.         END) AS [Duration]
  13. FROM [Games]
  14. ORDER BY [Name], [Duration], [Part of The Day]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement