Skip to content

JackJPhillips/SQL-Introduction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

SQL Introduction

This project was completed as part of a Data Technician bootcamp, focusing on developing core SQL skills to extract, analyse, and interpret insights from retail and sales datasets.

Project Overview

Using SQL, I explored the northwind database. The project involved writing and optimizing queries to simulate answering real-world business questions, such as filtering by countries, employee data, and joining different tables.

Skills Demonstrated

  • Writing queries using SELECT, WHERE, ORDER BY, and GROUP BY
  • Merging tables using the JOIN function to combine data across multiple sources
  • Filtering and sorting data to highlight key insights
  • Aggregating data to calculate totals, averages, and other metrics
  • Interpreting query results to support data-driven decision-making

SQL Work

Basic Exploring

The first thing I did was explore the data, pulling all info from a table before eventually exploring specific columns. The first step for this is to use the SELECT and FROM functions. * is a quick way of selecting all the columns from a table.

image
image
image

Using the DISTINCT function I could then see specific values in certain columns such as the differnt countries within the data.

image

This can be combined with the COUNT function in order to just show the number of unique values in a column.

image

Filtering Data

Filtering was then the next step, using WHERE can easily make only the required data in the columns appear.

image

Combined with the COUNT function again here is an exmaple of quickly seeing the number of customers located in the USA.

image
You can filter by ranges too.
image

You can use multiple filters either pulling more info with the OR or refine down the data even more using AND where all requirements must be met.

image image

NOT can also be used to exclude data.

image

Sorting Data

The ORDER BY function is used to arrange the data in a table.

image image

If only a certain amount of data needs to be shown either for top results or just to check the prompt use has worked as intended, LIMIT can be used.

image

Calculations

min() and max() can be used on columns within a table.

image image

Below are also examples of avg for an average and sum for a total.

image image

LIKE Filtering

It is possible to search and filter results based upon partial match to string data within the rows. The LIKE function makes it easy to scan data and % is used to represent any string.

image image image

_ is wildcard and is a way of denoting a character in the function, this means that you can specify a certain number or certain length of a string you are searching for without knowing what letters there actually are.

image

IN can also be used if all of the variables are in the same column.

image image

There is also a way to search a range just using the BETWEEN and AND function.

image

Joins

There is a way to only pull data from one table based upon details present in another, this is done with a sub query.

image

However, there is a function JOIN which allows you to merge two tables and show all of the data connected into one place.

image

When merging all data NULL values can be present.

image image

Group By

If you wish to use aggregate functions such as count and sum within table results the GROUP BY function must be used.

image
So if a business wanted to know how many orders had been handled by each of the shipping companies and the data was held across two different tables, we can combine everything we have done above in order to get a simple, straightforward answer.
image

We can make these more complex too and pull even more specific data.

image image

Outcome

This project helped solidify my understanding of relational databases and how to use SQL to turn raw data into actionable insights. It also laid the groundwork for more advanced data analysis and reporting tasks in future roles.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published