-
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.
* Add files via upload * Add files via upload
- Loading branch information
1 parent
569f67e
commit 0cf93f5
Showing
6 changed files
with
18 additions
and
6 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,9 @@ | ||
SELECT | ||
customer_rk, | ||
CASE | ||
WHEN middle_nm LIKE '%ИЧ' THEN 'M' | ||
WHEN middle_nm LIKE '%НА' THEN 'F' | ||
ELSE NULL | ||
END AS gender | ||
FROM cd_customers | ||
WHERE valid_to_dttm = '5999-01-01 00:00:00' |
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 monthly_income_amt as the_most_income | ||
FROM cd_customers | ||
WHERE valid_from_dttm >= '2014-01-01 00:00:00' AND valid_from_dttm < '2015-01-01 00:00:00' | ||
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,4 @@ | ||
SELECT CONCAT(SUBSTR(birth_dt, 1, 3), '0-e') as generation | ||
FROM cd_customers | ||
WHERE valid_to_dttm = '5999-01-01 00:00:00' | ||
GROUP BY generation DESC |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
USE srcdt; | ||
|
||
SELECT | ||
customer_rk, | ||
CASE | ||
|
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
USE srcdt; | ||
|
||
SELECT | ||
monthly_income_amt AS monthly_income2014 | ||
FROM | ||
|
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
USE srcdt; | ||
|
||
SELECT DISTINCT | ||
CONCAT(YEAR(birth_dt) - YEAR(birth_dt) % 10, '-е') AS generation | ||
FROM | ||
|