{"id":21818733,"url":"https://github.com/mrjaid23/covid19-data-analysis---sql-data-exploration","last_synced_at":"2026-02-16T09:03:00.247Z","repository":{"id":251343606,"uuid":"837134741","full_name":"mrjaid23/Covid19-Data-Analysis---SQL-Data-Exploration","owner":"mrjaid23","description":"SQL Data Exploration","archived":false,"fork":false,"pushed_at":"2024-08-04T17:53:42.000Z","size":11841,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T04:43:00.949Z","etag":null,"topics":["dataexploration","sql","sql-joins"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrjaid23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-02T09:35:05.000Z","updated_at":"2024-08-04T17:58:00.000Z","dependencies_parsed_at":"2025-07-27T08:30:21.753Z","dependency_job_id":"eca82734-9998-409f-b115-54409fa398ba","html_url":"https://github.com/mrjaid23/Covid19-Data-Analysis---SQL-Data-Exploration","commit_stats":null,"previous_names":["mrjaid23/covid19-data-analysis---sql-data-exploration"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrjaid23/Covid19-Data-Analysis---SQL-Data-Exploration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjaid23%2FCovid19-Data-Analysis---SQL-Data-Exploration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjaid23%2FCovid19-Data-Analysis---SQL-Data-Exploration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjaid23%2FCovid19-Data-Analysis---SQL-Data-Exploration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjaid23%2FCovid19-Data-Analysis---SQL-Data-Exploration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrjaid23","download_url":"https://codeload.github.com/mrjaid23/Covid19-Data-Analysis---SQL-Data-Exploration/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrjaid23%2FCovid19-Data-Analysis---SQL-Data-Exploration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29504684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T08:14:25.707Z","status":"ssl_error","status_checked_at":"2026-02-16T08:14:25.334Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataexploration","sql","sql-joins"],"created_at":"2024-11-27T16:14:45.898Z","updated_at":"2026-02-16T09:03:00.226Z","avatar_url":"https://github.com/mrjaid23.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL Data Exploration\n\n## SQL Data exploration techniques was performed on the WORLD's COVID-19 Dataset downloaded from OURWOLRD IN DATA's website\n\n[Dataset can be downloaded here](https://ourworldindata.org/covid-deaths)\n\n- Skills used: CASE Statements, Joins, CTE, Temp Tables, Windows Functions, Aggregate Functions, Operators, ALIASING, Creating Views, Converting Data Types\n\n\n-RENAMING TABLES\n\n```\nEXEC sp_rename '[dbo].[CovidDeaths$]', 'CovidDeaths';\n```\n\n```\nEXEC sp_rename '[dbo].[CovidVaccinations$]', 'CovidVaccinations'\n```\n\n--EXPLORING DATA FROM EACH TABLE\n\n```\nSELECT * \nFROM CovidDeaths\n\nSELECT *\nFROM CovidVaccinations\n```\n\n-- SELECTING REQUIRED DATA FROM dbo.CovidDeaths FOR EXPLORATION\n\n```\nSELECT Continent, Location, Date, Total_cases, New_cases, Total_deaths, Population\nFROM CovidDeaths\nORDER BY 1,2,3;\n```\n\n-- FILTERING OFF CONTINENTS WITH NULL VALUES\n\n```\nSELECT Continent, Location, Date, Total_cases, New_cases, Total_deaths, Population\nFROM CovidDeaths\nWHERE Continent IS NOT NULL\nORDER BY 1,2,3;\n```\n\n-- LIKELIHOOD OF DIEING DUE TO COVID (Total_case Vs Total_deaths) as DeathRateduetoCovid\n\n```\nSELECT Continent, Location, Date, Total_cases, Total_deaths, (Total_deaths/Total_cases)*100 AS PercentageDeathRateDuetoCovid\nFROM CovidDeaths\nWHERE Continent IS NOT NULL\nORDER BY 1,2,3;\n```\n\n```\nSELECT continent, Location, date, total_cases, total_deaths, \nCASE \n     WHEN total_cases = 0 THEN 0 \n     ELSE (total_deaths / total_cases) * 100 END AS PercentageDeathRate\nFROM CovidDeaths\nWHERE continent IS NOT NULL\nORDER BY 1,2,3;\n```\n\n-- EXPLORING DATA FOR SPECIFIC REGION e.g; United Kingdom\n\n```\nSELECT continent, Location, date, total_cases, total_deaths, \nCASE \n     WHEN total_cases = 0 THEN 0 \n     ELSE (total_deaths / total_cases) * 100 END AS PercentageDeathRate\nFROM CovidDeaths\nWHERE continent IS NOT NULL AND Location like '%kingdom%' \nORDER BY 1,2,3;\n```\n\n-- PREVALENCE RATE of COVID per Day - Total Cases vs Population \n\n```\nSELECT continent, Location, date, total_cases, population, (total_cases/population)*100 AS PrevalenceRate\nFROM [dbo].[CovidDeaths]\nWHERE continent IS NOT NULL\nORDER BY 1,2,3;\n```\n\n--The United Kingdom's PREVALENCE RATE of COVID per Day \n\n```\nSELECT continent, Location, date, total_cases, population, (total_cases/population)*100 AS PrevalenceRate\nFROM [dbo].[CovidDeaths]\nWHERE continent IS NOT NULL AND Location like '%Kingdom'\nORDER BY 1,2,3;\n```\n\n-- COUNTRIES WITH HIGHEST INFECTION RATE PER POPULATION\n\n```\nSELECT continent, Location, Population, MAX(total_cases) AS HighestInfectionCount, MAX((total_cases/population))*100 AS PercentPopulationINfected\nFROM [dbo].[CovidDeaths]\nWHERE continent IS NOT NULL\nGROUP BY continent, Location, Population\nORDER BY 4 DESC;\n```\n-- COUNTRIES WITH THE HIGHEST DEATH COUNT PER POPULATION\n\n```\nSELECT continent, Location, MAX(cast(total_deaths as bigint)) AS TotalDeathCount\nFROM [dbo].[CovidDeaths]\nWHERE continent IS NOT NULL\nGROUP BY continent, Location\nORDER BY 3 DESC;\n```\n\n-- DEATH RATE BY CONTINENT\n\n```\nSELECT continent, MAX(cast(total_deaths as bigint)) AS TotalDeathCount\nFROM [dbo].[CovidDeaths]\nWHERE continent IS NOT NULL\nGROUP BY continent\nORDER BY 2 DESC;\n```\n--GLOBAL NUMBERS PER DAY\n\n```\nSELECT Date, SUM(new_cases) AS total_cases, SUM(cast(new_deaths as int)) AS total_deaths, \nCASE\n\tWHEN SUM(new_cases) = 0 THEN 0 \n\tELSE SUM(cast(new_deaths as int))/ SUM(new_cases)*100\n\tEND AS PercentageDeathRate\nFROM [dbo].[CovidDeaths]\nWHERE continent IS NOT NULL\nGROUP BY Date\nORDER BY Date;\n```\n\n-- EXPLORE VACCINATION TABLE\n\n```\nSELECT *\nFROM [dbo].[CovidVaccinations]\n```\n\n-- JOIN BOTH TABLES\n\n```\nSELECT *\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n\tON dea.location = vac.location\n\tand dea.date = vac.date\n```\n\n-- Exploring Total Population vs Vaccination / day\n\n```\nSELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n\tON dea.location = vac.location\n\tand dea.date = vac.date\nWHERE dea.continent IS NOT NULL\nORDER BY 2,3;\n```\n\n-- Vaccination Overview of The UK\n\n```\nSELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n\tON dea.location = vac.location\n\tand dea.date = vac.date\nWHERE dea.continent IS NOT NULL AND dea.location like '%Kingdom%'\nORDER BY 2,3;\n```\n\n-- PARTITIONING VACCINATION COUNT BY LOCATION\n\n```\nSELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(CONVERT(bigint, vac.new_vaccinations)) OVER (PARTITION BY dea.location ORDER BY dea.location, dea.date ROWS UNBOUNDED PRECEDING) AS TotalVaccinationCount\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n    ON dea.location = vac.location\n    AND dea.date = vac.date\nWHERE dea.continent IS NOT NULL\nORDER BY dea.location, dea.date;\n```\n\n-- Using CTE to perform Calculation on Partition By in previous query\n\n```\nWITH PopVac (continent, location, date, Population, new_vaccinations, TotalVaccinationCount)\nAS\n(\nSELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(CONVERT(bigint, vac.new_vaccinations)) OVER (PARTITION BY dea.location ORDER BY dea.location, dea.date ROWS UNBOUNDED PRECEDING) AS TotalVaccinationCount\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n    ON dea.location = vac.location\n    AND dea.date = vac.date\nWHERE dea.continent IS NOT NULL\n--ORDER BY dea.location, dea.date\n--GROUP BY dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations\n)\nSELECT *, (TotalVaccinationCount/population)*100 AS PercentageVacRatePerPop\nFROM PopVac;\n```\n\n-- CREATING TABLE \u0026 INSERTING DATA\n\n```\nDROP TABLE IF EXISTS PercentageVacRatePerPop\nCREATE TABLE PercentageVacRatePerPop\n(\nContinent nvarchar(255),\nLocation nvarchar(255),\nDate datetime,\nPopulation numeric,\nNew_Vaccinations numeric,\nTotalVaccinationCount numeric\n)\nSELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(CONVERT(bigint, vac.new_vaccinations)) OVER (PARTITION BY dea.location ORDER BY dea.location, dea.date ROWS UNBOUNDED PRECEDING) AS TotalVaccinationCount\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n    ON dea.location = vac.location\n    AND dea.date = vac.date\nWHERE dea.continent IS NOT NULL\n--ORDER BY dea.location, dea.date\n--GROUP BY dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations\nSELECT *, (TotalVaccinationCount/population)*100 AS PercentageVacRatePerPop\nFROM PopVac;\n```\n-- CREATING A VIEW TABLE TO STORE DATA FOR LATER VISUALIZATIONS\n\n```\nCREATE VIEW PercentageVacRatePerPop_2 AS\nSELECT dea.continent, dea.location, dea.date, dea.population, vac.new_vaccinations, SUM(CONVERT(int, vac.new_vaccinations)) OVER (Partition by dea.location ORDER BY dea.location, dea.date) AS CummulatedVaccinations\nFROM [dbo].[CovidDeaths] AS dea\nJOIN [dbo].[CovidVaccinations] AS vac\n\tON dea.location = vac.location\n\tand dea.date = vac.date\nWHERE dea.continent IS NOT NULL;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjaid23%2Fcovid19-data-analysis---sql-data-exploration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrjaid23%2Fcovid19-data-analysis---sql-data-exploration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrjaid23%2Fcovid19-data-analysis---sql-data-exploration/lists"}