diff --git a/task1/Kholodov_1_1.sql b/task1/Kholodov_1_1.sql new file mode 100644 index 00000000..d480ccff --- /dev/null +++ b/task1/Kholodov_1_1.sql @@ -0,0 +1,7 @@ +SELECT customer_rk, + (CASE + WHEN middle_nm LIKE '%ИЧ' THEN 'M' + WHEN middle_nm LIKE '%А' THEN 'F' + END) AS gender +FROM cd_customers +WHERE valid_to_dttm = '5999-01-01' \ No newline at end of file diff --git a/task1/Kholodov_1_2.sql b/task1/Kholodov_1_2.sql new file mode 100644 index 00000000..5cc0b740 --- /dev/null +++ b/task1/Kholodov_1_2.sql @@ -0,0 +1,5 @@ +SELECT monthly_income_amt +FROM cd_customers +WHERE valid_to_dttm >= '2014.01.01' AND valid_from_dttm < '2015.01.01' +ORDER BY monthly_income_amt DESC +LIMIT 10; \ No newline at end of file diff --git a/task1/Kholodov_1_3.sql b/task1/Kholodov_1_3.sql new file mode 100644 index 00000000..ab421a1d --- /dev/null +++ b/task1/Kholodov_1_3.sql @@ -0,0 +1,5 @@ +SELECT DISTINCT + CONCAT(SUBSTRING(birth_dt, 1, 3), '0-e') as generation +FROM cd_customers +WHERE valid_to_dttm = '5999-01-01' +ORDER BY generation DESC; \ No newline at end of file