Skip to content

Commit

Permalink
Add task 01 (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakhodnov17 authored and CrafterKolyan committed Oct 2, 2019
1 parent e45ec6f commit 303e8a9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions task1/Nakhodnov_1_1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
select
cd_customers.customer_rk, (
case
when cd_customers.middle_nm like '%НА' then 'F'
when cd_customers.middle_nm like '%ИЧ' then 'M'
end
) as gender
from srcdt.cd_customers as cd_customers
where cd_customers.valid_to_dttm = '5999-01-01 00:00:00'
5 changes: 5 additions & 0 deletions task1/Nakhodnov_1_2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
select cd_customers.monthly_income_amt
from srcdt.cd_customers as cd_customers
where 2014 >= year(cd_customers.valid_from_dttm) and year(cd_customers.valid_to_dttm) >= 2014
order by cd_customers.monthly_income_amt desc
limit 10
4 changes: 4 additions & 0 deletions task1/Nakhodnov_1_3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
select distinct concat(floor(year(cd_customers.birth_dt) / 10), '0-е') as generation
from srcdt.cd_customers as cd_customers
where cd_customers.valid_to_dttm = '5999-01-01 00:00:00'
order by generation desc

0 comments on commit 303e8a9

Please sign in to comment.