Data Analyst Portfolio Project | SQL Data Exploration | Project 1/4
Introduction to Data Analyst Portfolio Project Series
In this section, the speaker introduces the Data Analyst Portfolio Project series and provides an overview of the four projects that will be covered. The projects include SQL for data exploration and visualization in Tableau, Tableau for data visualization, SQL for ETL (Extract, Transform, Load) process and data cleaning, and Python with Pandas for data cleaning and visualization.
Projects Overview
- The first project focuses on SQL for data exploration and setting up data for visualization in Tableau.
- The second project is centered around using Tableau for data visualization.
- The third project involves going back to SQL but with a focus on the ETL process and more advanced data cleaning techniques.
- The fourth and final project utilizes Python with Pandas for both data cleaning and visualization.
Purpose of the Series
- The goal of this series is to help viewers build a comprehensive portfolio that can be used when applying for a Data Analyst job.
- Viewers are encouraged to copy scripts and queries provided but also encouraged to think of their own queries and insights to make their portfolio unique.
Getting Started on the First Project
In this section, the speaker begins working on the first project by downloading the dataset, formatting it in Excel, and then importing it into SQL for querying.
Downloading the Dataset
- It is recommended not to use the option provided within the video but instead go back to the beginning of the graph shown in order to download all available information.
- The dataset contains various information related to COVID-19 cases such as total cases, new cases, total deaths, new deaths, vaccinations, population, etc.
Formatting the Dataset
- After downloading the dataset, some basic formatting is done in Excel before importing it into SQL.
- The population column is cut from the end of the dataset and inserted at the beginning to avoid unnecessary joins in future queries.
Walkthrough of the Project Steps
In this section, the speaker explains that they will walk through each step of the project without any cuts to ensure viewers understand the process.
Detailed Walkthrough
- The speaker aims to provide a comprehensive walkthrough of each step without any cuts to prevent viewers from getting lost.
- The video may be long, potentially over an hour and a half, but efforts will be made to keep it as concise as possible.
- No cuts are made in order to explain each step thoroughly.
Exploring and Reformatting the Dataset
In this section, the speaker explores the downloaded dataset and explains its contents. They also demonstrate how to reformat certain columns for further analysis.
Dataset Exploration
- The dataset contains extensive information on COVID-19 cases, going back to early 2020.
- Key data points include total cases, new cases, total deaths, new deaths, vaccinations, people vaccinated, and population.
- There is additional unique data available for further exploration such as information on smokers and diabetes.
Reformatting Columns
- The population column is moved from its original position at the end of the dataset to be placed at the beginning using Excel's cut and insert functions.
- This reformatting step helps optimize future queries by avoiding unnecessary joins with every query.
Conclusion and Next Steps
In this section, the speaker concludes their explanation of formatting steps and emphasizes completing the project efficiently.
Completing Formatting Steps
- After reformatting columns in Excel, all necessary steps for formatting the dataset are completed.
- The speaker emphasizes the importance of completing the project efficiently and not spending excessive time exploring additional data points.
Timestamps have been associated with bullet points as requested.
Creating the First Table
In this section, the speaker explains how to create the first table in SQL by deleting unnecessary data from an Excel file.
Deleting Unnecessary Data
- Click on Control + Shift + Right Key to select all the unnecessary data.
- Delete the selected data to create the first table.
- Save the file as "covid deaths" in the downloads folder.
Saving Vaccination Information
The speaker discusses saving vaccination information and mentions that it will be joined with another table later.
Deleting Unnecessary Data (Again)
- Select and delete all unnecessary data from another Excel file containing vaccination information.
- Save the file as "covid vaccinations" in the downloads folder.
Saving Files and Creating a Database
The speaker explains how to save the modified Excel files and create a database for importing them into SQL.
Saving Modified Files
- Save "covid deaths" as an Excel workbook.
- Save "covid vaccinations" as an Excel workbook.
Creating a Database
- Open SQL and create a new database called "portfolio project."
- Confirm that the tables within the database are empty, as this is where we will import our Excel files.
Importing Excel Files into SQL
The speaker shares their experience of having trouble importing Excel files into SQL and suggests an alternative method that worked for them.
Troubles with Importing
- Attempted various methods but encountered errors while importing.
- Suggests trying to import using "Tasks" > "Import Data" within SQL. However, it did not work for them personally due to 32-bit vs. 64-bit issues.
Alternative Method
- Open Microsoft SQL Server 2019 and click on "Import and Export."
- This method uses the 64-bit version, which resolved the import issue for the speaker.
- Browse to select the Excel file from the downloads folder.
- Save the file as an Excel workbook.
- Select the appropriate server name (e.g., "portfolio project").
- Copy the data to the destination database.
- Complete the import process.
Working with a Large Dataset
The speaker mentions that there is a significant amount of data in the imported files and discusses their plan to cover various SQL concepts.
Dataset Size
- The dataset contains around 89,000 records (may vary).
- Acknowledges that it is a substantial amount of data.
Learning Objectives
- Plan to cover basic querying of tables first.
- Will progress to more advanced topics such as joins, CTEs, temp tables, and creating views.
- Aims to showcase advanced SQL techniques for potential employers.
The transcript does not provide further details on specific queries or topics covered beyond this point.
New Section
In this section, the speaker discusses the process of importing and organizing data related to COVID-19 vaccinations and deaths in Excel.
Importing Data from Excel
- The speaker initially confuses the data for COVID-19 deaths with COVID-19 vaccinations.
- Timestamp:
- They clarify the confusion and proceed to import the data for COVID-19 vaccinations.
- Timestamp:
- The destination for importing the data is set as SQL Server Native Client.
- Timestamp:
- The speaker advises creating separate Excel sheets for COVID-19 deaths and vaccinations, uploading them, and renaming them accordingly.
- Timestamp:
Verifying Imported Tables
- The speaker queries the imported tables to ensure they contain the correct data.
- Timestamp:
- They confirm that one table contains data on COVID-19 vaccinations, while the other table contains data on COVID-19 deaths.
- Timestamp:
New Section
In this section, the speaker prepares to analyze and manipulate the imported data.
Selecting Relevant Data
- The speaker selects specific columns from both tables that will be used for analysis.
- Timestamp:
Calculating Percentage of Deaths
-The speaker explains a simple calculation to determine the percentage of deaths based on total cases in a country.
-Timestamp:
New Section
The speaker discusses the death percentage and provides calculations for different scenarios.
Death Percentage Calculation
- The current death rate in Afghanistan is 0.029 percent.
- To calculate the percentage, multiply the rate by 100.
- When there were 34 cases and one death, the death rate was 2.94 percent.
- As of now, with 59,745 total cases and 22,625 deaths in Afghanistan, the death rate is approximately 4 percent.
New Section
The speaker continues discussing the death rates in Afghanistan and compares them to other countries.
Death Rates Comparison
- In Afghanistan, there is currently a 4 percent chance of dying if infected with COVID-19.
- The speaker mentions living in the United States but encourages viewers to check their own country's data.
- Initially, there were high percentage rates which have decreased over time.
- At the end of the year, there were over 20 million infections and around 352,000 deaths in the United States.
- By the end of the year, globally there were over 32 million infections and approximately 576,000 deaths.
New Section
The speaker reflects on the large number of infections and deaths worldwide due to COVID-19.
Global Infections and Deaths
- Globally, over 32 million people have been infected with COVID-19.
- There have been approximately 576,000 deaths worldwide due to COVID-19.
- These numbers are verified through online sources like Google.
New Section
The speaker discusses rough estimates of the likelihood of dying from COVID-19 based on current data.
Likelihood of Dying from COVID-19
- As of now, there is a rough estimate of a 1.75 to 2 percent chance of dying if infected with COVID-19.
- The speaker emphasizes that these are rough estimates and may vary by country.
- Exploratory data analysis will provide more advanced insights in the future.
New Section
The speaker explains how to analyze the total cases versus population data and encourages viewers to filter by their own country.
Analyzing Total Cases versus Population
- The speaker suggests analyzing the percentage of the population that has been infected with COVID-19.
- Viewers can filter the data by their own country for more relevant statistics.
- The speaker focuses on analyzing data for the United States due to personal relevance.
- At the beginning, when there was only one case, it represented a negligible percentage of the population.
- By August of last year, approximately 1 percent of the U.S. population had been infected (around 3.31 million people).
New Section
The speaker discusses providing additional notes and recommendations while typing out the information.
Additional Notes and Recommendations
- Some notes provided during typing may not be necessary for study purposes.
- Detailed notes will be included in an uploaded file on GitHub.
- It is important to focus on what is deemed essential from this transcript.
New Section
The speaker continues discussing percentages of population infected with COVID-19.
Percentage Infected with COVID-19
- The current population in the United States is around 331 million.
- When there was one case, it represented an insignificant portion of the population.
- By August last year, approximately 1 percent (around 3.31 million people) had been infected in the U.S.
The transcript does not provide further sections or timestamps beyond this point.
Visualizing Data in Tableau
The speaker discusses the importance of visualizing data in Tableau and mentions having a map as an example.
Creating a Visualization in Tableau
- The speaker mentions using Tableau to visualize data.
- They show a map visualization that they quickly put together, demonstrating how different countries can be represented on the map.
- The speaker emphasizes the need to envision how data will be visualized in the future.
Analyzing Infection Rates by Country
The speaker expresses curiosity about which countries have the highest infection rates compared to their population.
Querying for Highest Infection Rates
- The speaker explains their intention to write a query that identifies countries with the highest infection rates relative to their population.
- They mention keeping the location information and looking at the maximum total cases for each country.
- An alias is given to represent the highest infection count per country.
- The query also includes calculating the percentage of population infected.
Comparing Infection Rates among Countries
The speaker compares infection rates among different countries, highlighting those with high percentages of infected population.
Examining Infection Rates
- The speaker orders the results based on the percentage of population infected, starting with the highest number first.
- They observe that some smaller countries have high infection rates, while larger countries like Israel, Belgium, Portugal, France, and the United States are also prominent on the list.
Analyzing Death Counts by Country
The focus shifts from infection rates to analyzing death counts by country.
Identifying Countries with Highest Death Counts
- A new query is introduced to identify countries with the highest death counts relative to their population.
- The query includes selecting the location and using the max function for total deaths.
- The results are ordered based on the total death count.
The transcript provided does not include timestamps for all sections.
Casting Data Types
In this section, the speaker discusses the importance of looking at data types when encountering issues and demonstrates how to cast a data type.
Casting Data Type
- The speaker suggests that when facing issues, it is essential to analyze the data and consider if the problem lies with the data type.
- To resolve such issues, casting can be used. In this case, the speaker casts a column as an integer using
CAST(column_name AS int).
- By casting the column, they are able to convert a varchar255 value into an integer.
Issue with Location Data
This section focuses on identifying and addressing an issue related to location data in the dataset.
Identifying the Issue
- The speaker notices that some entries in the location section contain names of entire continents like "world," "africa," or "south america."
- They compare it with other entries where only specific countries are mentioned under location but have "asia" as their continent.
- Additionally, they observe that in some cases, the continent field is null for these entries.
Resolving the Issue
- To address this issue, they modify their query to include a condition where
continentis not null.
- This ensures that only specific country-level locations are considered and eliminates entries representing entire continents.
Filtering by Continent
Here, the speaker explores filtering data by continent and discusses its relevance for further analysis and visualization.
Breaking Down by Continent
- The speaker modifies their query to break down data by continent instead of location.
- They add a filter condition
WHERE continent IS NOT NULLto exclude entries without a specified continent.
Analyzing Death Count by Continent
This section focuses on analyzing the death count by continent and discussing the significance of the numbers.
Death Count Analysis
- The speaker observes that the United States has the highest death count, with 576,000 deaths.
- They mention that these numbers are accurate but may be slightly behind real-time due to reporting delays.
- The dataset downloaded may have higher numbers as time progresses.
Limitations and Drill Down Effect
Here, the speaker discusses limitations in data accuracy and introduces the concept of drill down effect for further analysis.
Limitations in Data Accuracy
- The speaker acknowledges small issues in data accuracy, such as excluding Canadian numbers from North America.
- However, they note that for their purposes, which do not involve fact-checking or data verification, these minor inaccuracies are acceptable.
Importance of Drill Down Effect
- To enhance visualization and analysis capabilities, they suggest including continent information in queries to enable drill down into specific regions.
- They consider using filters like
WHERE continent IS NULLto focus on location-level data for more accurate results.
Finalizing Query Approach
In this section, the speaker reflects on their query approach and decides to make adjustments based on improved understanding.
Adjusting Query Approach
- The speaker realizes that filtering by
locationinstead ofcontinentprovides more accurate results.
- They decide to revert back to their original approach of filtering by location for better visualizations and correct numbers.
Timestamps are approximate.
Analyzing Data by Continent
In this section, the speaker discusses breaking down data by continent and performing queries based on continents. They also mention the importance of creating views for visualization purposes.
Analyzing Data by Continent
- To analyze data by continent, queries can be modified to include the continent as a parameter.
- Adding the continent parameter allows for a drill-down effect where specific continents or countries within a continent can be selected.
- Creating views is important for later visualization in tools like Tableau.
Calculating Global Numbers
The speaker explains how to calculate global numbers and mentions the use of aggregate functions to group data.
Calculating Global Numbers
- To calculate global numbers, exclude any location or continent filters and focus on all countries.
- Grouping data by date is essential when analyzing global numbers.
- Aggregate functions like sum can be used to calculate total cases or new cases across all countries.
Handling Aggregate Functions and Summing New Cases
The speaker addresses challenges with aggregate functions and suggests using the "new cases" column for calculating totals.
Handling Aggregate Functions and Summing New Cases
- When dealing with aggregate functions, it's important to avoid nesting them within each other.
- Instead of using max function, summing the "new cases" column provides accurate totals.
- By summing new cases without any location or continent filters, we can obtain daily totals across the world.
The transcript does not provide further timestamps or content beyond this point.
New Section
The speaker discusses an error related to operand data type and varchar being invalid.
- The error message "operand data type and varchar is invalid" is mentioned.
New Section
The speaker mentions the limited data they have looked at and encourages creating multiple views for further analysis.
- The speaker mentions that they could have spent more time analyzing the data but due to its vastness, they will only demonstrate how to create one view. They encourage the audience to create multiple views themselves.
New Section
The speaker suggests creating a view for specific numbers of interest, such as global numbers.
- The speaker advises viewers to consider creating a view for specific numbers of interest, such as global vaccination rates. They mention that some numbers may not make sense to include in a view.
New Section
Steps for creating a view are explained.
- The speaker demonstrates how to create a view by using the SQL command "CREATE VIEW". They mention that creating views is easy and show an example using the same syntax as before.
- They remove the unnecessary "ORDER BY" clause from the previous query.
- After running the query successfully, they check if the new view appears in their list of views by refreshing it.
- They highlight that once created, a view becomes permanent and can be used for future visualizations or querying purposes. They encourage viewers to create similar views based on their own queries.
New Section
The speaker discusses the use of views in a professional setting and mentions connecting Tableau to these views.
- In a professional setting, the speaker suggests organizing views into separate categories, such as work views or work tables. They explain that this allows for consistent usage and connection with Tableau for visualization purposes.
- However, they mention that in the upcoming tutorial, they will be using Tableau Public instead of the paid version of Tableau. They highlight that Tableau Public does not connect to SQL databases but is accessible to anyone for free.
New Section
The speaker introduces the use of Tableau Public for visualizing data.
- The speaker explains that in the next tutorial, they will be using Tableau Public to create visualizations based on the created views. They aim to create at least five visualizations and a dashboard.
- They mention that Tableau Public is recommended because it is free and accessible to everyone.
New Section
Saving and storing code files in GitHub is discussed.
- The speaker demonstrates how to save the current file by clicking on "File" and then "Save As". They recommend creating multiple versions if needed.
- They navigate to their GitHub account and show how to create a new repository named "portfolio projects". They mention that having a GitHub account is beneficial for storing portfolio projects related to SQL and Python.
- After creating the repository, they upload an existing file by selecting it from their local machine. They emphasize that notes can be added during this process if desired.
- Finally, they showcase the uploaded file in GitHub, highlighting that it provides a good place to store code and allows for better documentation and comments. They mention that further improvements on how to display the code will be discussed in future videos.
fantastic and i really hope that it pays
The speaker expresses enthusiasm and optimism about a certain topic.
Key Points:
- The speaker is excited and hopeful about something.
- It is implied that the speaker expects some kind of financial or personal gain from this topic.
Turn any video into a summary like this
YouTube links, meetings, lectures. With transcripts, search, and chat.