Professional Documents
Culture Documents
Webinar Intro To Data Analytics SQL Fundamentals
Webinar Intro To Data Analytics SQL Fundamentals
Webinar Intro To Data Analytics SQL Fundamentals
Welcome to Thinkful!
We teach tech skills that lead to fulfilling, high-paying careers.
❏ What Is SQL?
Workshop ❏
❏
Why SQL?
SQL Syntax Introduction
Rundown
❏ SQL Practice
❏ Frequently Asked Questions
❏ Further Resources
Industry Overview Applied Examples FAQ’s Take Action!
Skillset
Spreadsheets
Basic Critical
Programming Thinking
and Stats
Data Analyst
Business Intel
SQL
Tools
Presentation
&
Communication
Industry Overview Applied Examples FAQ’s Take Action!
What Is SQL?
❏ Structured Query Language
❏ Usually pronounced like the
word “sequel”
❏ Communicates with databases
to manage data
Industry Overview Applied Examples FAQ’s Take Action!
Database Systems
SQL Syntax
Industry Overview Applied Examples FAQ’s Take Action!
Database Setup
SQL Schema SQL Playground
rows
books
Syntax: Example:
SELECT column_list SELECT title, year
FROM table_name FROM books
Industry Overview Applied Examples FAQ’s Take Action!
books
result
title year
SQL Statements:
WHERE
Syntax:
Filters relevant results
SELECT column_list
➔ Returns only results that FROM table_name
meet the condition WHERE condition
Industry Overview Applied Examples FAQ’s Take Action!
WHERE SELECT *
FROM books
WHERE SELECT *
FROM books
WHERE year > 2000
result
SQL Statements:
AND/OR/NOT
Used with WHERE clause to filter
based on multiple conditions Syntax:
➔ NOT displays ALL that are NOT WHERE condition1 OR condition2 OR condition3
true
Industry Overview Applied Examples FAQ’s Take Action!
result
title author
SQL Statements:
GROUP BY
Syntax:
➔ Maximum (MAX)
Industry Overview Applied Examples FAQ’s Take Action!
SQL Statements:
ORDER BY
Syntax:
Sorts the result set
SELECT column_list
➔ Ascending (default) FROM table_name
➔ Descending (DESC) ORDER BY column1, column2 ASC|DESC
Industry Overview Applied Examples FAQ’s Take Action!
ORDER BY SELECT *
FROM books
result
books ORDER BY year DESC
book_id
id title
title author
author year
year
1 HarryPotter
Harry Potterandand
the the Half-Blood
Half-Blood Prince Prince J. K.
J. K.Rowling
Rowling 2005
2005
3
2 The Da
Pride andVinci Code
Prejudice Dan Brown
Jane Austen 2003
1813
2
3 Pride
The and Prejudice
Da Vinci Code JaneBrown
Dan Austen 1813
2003
Industry Overview Applied Examples FAQ’s Take Action!
Relational Tables
➔ Tables in the database are related based on unique keys
books
reviews
id title author
book_id average_rating
1 Harry Potter and the J. K. Rowling
Half-Blood Prince 1 4.7
Syntax:
SELECT column_list
FROM table_name
JOIN second_table ON table_name.key_column = second_table.key_column
Industry Overview Applied Examples FAQ’s Take Action!
Example:
SQL Statements: SELECT b.title, r.average_rating
2 4.5
2 Pride and Prejudice Jane Austen 1813
3 4.5
3 The Da Vinci Code Dan Brown 2003
Industry Overview Applied Examples FAQ’s Take Action!
title average_rating
SQL Challenge!
Industry Overview Applied Examples FAQ’s Take Action!
Bikeshare Challenge
❏ You are a part of a team analyzing bikeshare usage in the Bay Area.
❏ Data on stations, trips taken, and the weather at those stations have
been compiled.
❏ Your task: Use data to answer questions to better understand
bikeshare usage
Industry Overview Applied Examples FAQ’s Take Action!
Challenge:
date
trip_id
*temperature_f
Database duration
start_date
*dew_point
Structure start_station
*humidity
*sea_level_pressureIn
Table Name: stations start_terminal
*visibility
name end_date
*wind_speed_mph
lat end_station
precipitation_in
long end_terminal
cloud_cover
dockcount bike_id
events
city subscriber_type
wind_dir_degrees
installation zip_code
zip
“*” indicates that there are columns for min, mean, and max values for this indicator
Industry Overview Applied Examples FAQ’s Take Action!
Challenge Level:
Beach Cruising
Challenge Level:
Road Race
Write SQL queries to pull the following information:
❏ What is the average number of docks at all stations?
❏ Which zip code has the highest average maximum precipitation?
❏ Which station was the most popular destination? How many trips
ended at this station?
❏ For each starting station, list the average trip duration by
descending duration (BONUS: add the city)
Industry Overview Applied Examples FAQ’s Take Action!
Challenge Level:
Tour de France
Challenge Answers
?
Common Questions
Schedule a Call