From 3bc5b709e46aa8df95ead053a51745e90bd3b380 Mon Sep 17 00:00:00 2001 From: itsAbilash <102655634+itsAbilash@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:01:43 -0600 Subject: [PATCH] add Game_Play_Analysis I.txt,Report_Contiguos_Dates.txt,Students_Reported_By_Geography.txt,average_sal_company.txt --- Game_Play_Analysis I.txt | 1 + Report_Contiguos_Dates.txt | 5 +++++ Students_Reported_By_Geography.txt | 5 +++++ average_sal_company.txt | 0 4 files changed, 11 insertions(+) create mode 100644 Game_Play_Analysis I.txt create mode 100644 Report_Contiguos_Dates.txt create mode 100644 Students_Reported_By_Geography.txt create mode 100644 average_sal_company.txt diff --git a/Game_Play_Analysis I.txt b/Game_Play_Analysis I.txt new file mode 100644 index 0000000..db6cb4a --- /dev/null +++ b/Game_Play_Analysis I.txt @@ -0,0 +1 @@ +select player_id,min(event_date) as first_login from activity group by player_id; \ No newline at end of file diff --git a/Report_Contiguos_Dates.txt b/Report_Contiguos_Dates.txt new file mode 100644 index 0000000..b46208d --- /dev/null +++ b/Report_Contiguos_Dates.txt @@ -0,0 +1,5 @@ +WITH CTE AS ( + SELECT 'failed' as period_state, fail_date as dat, rank() over(order by fail_date) as rnk from failed where year(fail_date) = 2019 + union all + SELECT 'succeeded' as period_state, success_date as dat, rank() over(order by success_date) as rnk from succeeded where year(success_date) = 2019 +) select period_state, min(dat) as start_date, max(dat) as end_date from (select *, rank() over(order by dat)-rnk as grp_rnk from cte) a group by grp_rnk,period_state order by start_date; \ No newline at end of file diff --git a/Students_Reported_By_Geography.txt b/Students_Reported_By_Geography.txt new file mode 100644 index 0000000..e93d63c --- /dev/null +++ b/Students_Reported_By_Geography.txt @@ -0,0 +1,5 @@ +select America, Asia, Europe from( +(SELECT @am := 1 , @as := 1, @eu := 1)t1, +(SELEcT @as := @as + 1 as asrnk, name as 'Asia' from Student where continent = 'Asia' order by name)t2 right join +(SELECT @am := @am + 1 as amrnk, name as 'America' from Student where continent = 'America' order by name)t3 on t2.asrnk = t3.amrnk left join +(SELECT @eu := @eu + 1 as eurnk, name as 'Europe' from Student where continent = 'Europe' order by name)t4 on t3.amrnk = t4.eurnk) \ No newline at end of file diff --git a/average_sal_company.txt b/average_sal_company.txt new file mode 100644 index 0000000..e69de29