Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --24.*Countries and Currency (Euro / Not Euro)
- SELECT CountryName, CountryCode, Currency =
- Case CurrencyCode
- When 'EUR' THEN 'EURO'
- ELSE 'NOT EURO'
- END
- FROM Countries
- ORDER BY CountryName;
- --
- SELECT [Name],
- [Part of the Day] =
- CASE
- WHEN DATEPART(hour, [Start]) BETWEEN 0 AND 11 THEN 'Morning'
- WHEN DATEPART(hour, [Start]) BETWEEN 12 AND 17 THEN 'Afternoon'
- ELSE 'Evening'
- END,
- Duration =
- CASE
- WHEN Duration <= 3 THEN 'Extra Short'
- WHEN Duration <= 6 THEN 'Short'
- WHEN Duration > 6 THEN 'Long'
- ELSE 'Extra Long'
- END
- FROM Games
- ORDER BY [Name], Duration, [Part of the Day];
- --9. Age Groups
- WITH CTE AS
- (
- SELECT
- (CASE
- WHEN Age BETWEEN 0 AND 10 THEN '[0-10]'
- WHEN Age BETWEEN 11 AND 20 THEN '[11-20]'
- WHEN Age BETWEEN 21 AND 30 THEN '[21-30]'
- WHEN Age BETWEEN 31 AND 40 THEN '[31-40]'
- WHEN Age BETWEEN 41 AND 50 THEN '[41-50]'
- WHEN Age BETWEEN 51 AND 60 THEN '[51-60]'
- ELSE '[61+]'
- END) AS AgeGroup, Id
- FROM WizzardDeposits
- )
- SELECT AgeGroup, COUNT(Id) AS WizardCount
- FROM CTE
- GROUP BY AgeGroup;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement