MENU

Challenge Lab

Qwiklabs [GSP787]

Task 1:

Total Confirmed Cases



Build a query that will answer "What was the total count of confirmed cases on Apr 15, 2020?" The query needs to return a single row containing the sum of confirmed cases across all countries. The name of the column should be total_cases_worldwide.
code (A):

Query 2: Worst Affected Areas

Build a query for answering "How many states in the US had more than 100 deaths on Apr 10, 2020?" The query needs to list the output in the field count_of_states. Hint: Don't include NULL values.
code (B)

Query 3: Identifying Hotspots

Build a query that will answer "List all the states in the United States of America that had more than 1000 confirmed cases on Apr 10, 2020?" The query needs to return the State Name and the corresponding confirmed cases arranged in descending order. Name of the fields to return state and total_confirmed_cases.
code (C):

Query 4: Fatality Ratio

Build a query that will answer "What was the case-fatality ratio in Italy for the month of April 2020?" Case-fatality ratio here is defined as (total deaths / total confirmed cases) * 100. Write a query to return the ratio for the month of April 2020 and containing the following fields in the output: total_confirmed_cases, total_deaths, case_fatality_ratio.
code (D):

Query 5: Identifying specific day

Build a query that will answer: "On what day did the total number of deaths cross 10000 in Italy?" The query should return the date in the format yyyy-mm-dd.
code (E)

Query 6: Finding days with zero net new cases

The following query is written to identify the number of days in India between 21 Feb 2020 and 15 March 2020 when there were zero increases in the number of confirmed cases. However it is not executing properly.
code (F):

Query 7: Doubling rate

Using the previous query as a template, write a query to find out the dates on which the confirmed cases increased by more than 10% compared to the previous day (indicating doubling rate of ~ 7 days) in the US between the dates March 22, 2020 and April 20, 2020. The query needs to return the list of dates, the confirmed cases on that day, the confirmed cases the previous day, and the percentage increase in cases between the days. Use the following names for the returned fields: Date, Confirmed_Cases_On_Day, Confirmed_Cases_Previous_Day and Percentage_Increase_In_Cases.
code (G):

Query 8: Recovery rate

Build a query to list the recovery rates of countries arranged in descending order (limit to 10) upto the date May 10, 2020. Restrict the query to only those countries having more than 50K confirmed cases. The query needs to return the following fields: country, recovered_cases, confirmed_cases, recovery_rate.
code (H):

Query 9: CDGR - Cumulative Daily Growth Rate

The following query is trying to calculate the CDGR on May 10, 2020(Cumulative Daily Growth Rate) for France since the day the first case was reported. The first case was reported on Jan 24, 2020.
code (I):

Create a Datastudio report

Create a Datastudio report that plots the following for the United States
code (J):

2 comments:

  1. errpr with task 9
    got score by running the following query


    WITH
    france_cases AS (
    SELECT
    date,
    SUM(cumulative_confirmed) AS total_cases
    FROM
    `bigquery-public-data.covid19_open_data.covid19_open_data`
    WHERE
    country_name="France"
    AND date IN ('2020-01-24',
    '2020-05-10')
    GROUP BY
    date
    ORDER BY
    date)
    , summary as (
    SELECT
    total_cases AS first_day_cases,
    LEAD(total_cases) OVER(ORDER BY date) AS last_day_cases,
    DATE_DIFF(LEAD(date) OVER(ORDER BY date),date, day) AS days_diff
    FROM
    france_cases
    LIMIT 1
    )
    select first_day_cases, last_day_cases, days_diff, POW((last_day_cases/first_day_cases),(1/days_diff))-1 as cdgr
    from summary

    ReplyDelete
  2. WITH
    france_cases AS (
    SELECT
    date,
    SUM(cumulative_confirmed) AS total_cases
    FROM
    `bigquery-public-data.covid19_open_data.covid19_open_data`
    WHERE
    country_name="France"
    AND date IN ('2020-01-24',
    '2020-05-10')
    GROUP BY
    date
    ORDER BY
    date)
    , summary as (
    SELECT
    total_cases AS first_day_cases,
    LEAD(total_cases) OVER(ORDER BY date) AS last_day_cases,
    DATE_DIFF(LEAD(date) OVER(ORDER BY date),date, day) AS days_diff
    FROM
    france_cases
    LIMIT 1
    )

    select first_day_cases, last_day_cases, days_diff, POW((last_day_cases/first_day_cases),(1/days_diff))-1 as cdgr
    from summary

    ReplyDelete

We appreciate your feedback, We will definitely send it to Prakash Foundation.
Thanks for feedback.