From 401c23a14fb9caa3c3d1b25d6393b7cb0c2b243e Mon Sep 17 00:00:00 2001 From: anuroopreddy21 Date: Thu, 6 Jun 2024 12:17:16 +0530 Subject: [PATCH] Task 3 of shiptivitas completed --- answer.sql | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/answer.sql b/answer.sql index 8953319..d806536 100644 --- a/answer.sql +++ b/answer.sql @@ -2,12 +2,16 @@ -- PART 1: Create a SQL query that maps out the daily average users before and after the feature change - - +SELECT +count(distinct user_id) as daily_users, +DATE(login_timestamp, 'unixepoch') as login_date, +strftime('%j', DATE(login_timestamp, 'unixepoch')) AS day_of_year +FROM login_history +GROUP BY day_of_year -- PART 2: Create a SQL query that indicates the number of status changes by card - - - - - +SELECT cardId, +count(id) as n_status_change +FROM card_change_history +WHERE oldStatus <> newStatus +GROUP BY cardId; \ No newline at end of file