-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem set 1 solutions added by Maksim Eremeev (#52)
* Problem set 1 solutions added * Problem set 1 solutions added * minor
- Loading branch information
1 parent
303e8a9
commit 569f67e
Showing
3 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SELECT | ||
customer_rk, | ||
CASE | ||
WHEN middle_nm LIKE '%А' THEN 'F' | ||
WHEN middle_nm LIKE '%Ч' THEN 'M' | ||
END AS Gender | ||
FROM cd_customers WHERE YEAR(valid_to_dttm) = 5999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SELECT | ||
monthly_income_amt | ||
FROM cd_customers | ||
WHERE YEAR(valid_from_dttm) <= 2014 AND YEAR(valid_to_dttm) >= 2014 | ||
ORDER BY monthly_income_amt DESC | ||
LIMIT 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT DISTINCT | ||
CONCAT(FLOOR(YEAR(birth_dt) / 10), '0-е') AS Generation | ||
FROM cd_customers | ||
WHERE YEAR(valid_to_dttm) = 5999 | ||
ORDER BY Generation DESC |