Welcome To General Assembly
Welcome To General Assembly
ASSEMBLY
Let’s get started...
General Assembly
INTRO TO SQL
Your Instructor
Nigel Caldon
Data Analytics Instructor, General Assembly
Economics, New York University
Worked at:
A database is a set of data that has a regular structure and that is organized in
such a way that a computer can easily find the desired information.
Source: The Linux Information Project
In other words, Excel is a local tool that is not able to capably manage or interact
with very large datasets. This is when SQL steps in!
● SQL can rapidly navigate databases and query, retrieve, and aggregate millions of records.
● SQL is also more adept than Excel at creating data flows for cleaning and preparing data at
high volumes.
● SQL is the industry standard for data query and retrieval.
However...
In other words, SQL is not a replacement for Excel. Instead, SQL is often used in
conjunction with Excel and other Business Intelligence tools.
WHAT WE’RE
USING TODAY
● It’s never going to be this easy to setup and configure your environment
● There are many small (and sometimes important) differences between SQL dialects
http://bit.ly/codelabsql
Remember, this only works in Chrome, Safari, and Opera
Source: Dataedo
DIRECTIONS
1. Click on each table to explore the data (and notice that CodeLab
generates a SQL query each time).
2. Examining the column headers, figure out the relationship between
ACTIVITY the orders, order_details, products, and customers tables.
3. Document these tables as an Entity Relationship Diagram.
DELIVERABLE
country price
● Carriage returns and tabs are ignored, and are often used to enhance readability.
Retrieve just the “product_name” and “price” fields... ...from the table “products”
DIRECTIONS
1. Create a table that includes just the order_id and order_value fields.
2. Display the top 10 largest orders.
ACTIVITY
DELIVERABLE
Executed SQL query that results in the top 10 largest orders and their
associated order IDs.
P Parentheses:
these go first.
Exponents:
E
powers and square roots are next.
Multiplication & Division:
MD
left to right.
Addition & Subtraction:
AS
left to right.
= Equal to.
!= Not equal to.
>, >= Greater than, greater than or equal to.
<, <= Less than, less than or equal to.
BETWEEN Within the range of.
IN ( ) Found in list of items.
LIKE Contains item.
% Wildcard.
DIRECTIONS
1. Create a table that includes just the order_id and order_value fields.
2. Display the orders where the order_value is greater than $4,000.
ACTIVITY
DELIVERABLE
Executed SQL query that results in orders over $4,000 and their associated
order IDs.
A valuable SQL commands to include aggregations is GROUP BY. This indicates the
dimensions you want to group your data by (e.g., a category that you wish to sort into
subgroups).
DIRECTIONS
ACTIVITY
DELIVERABLE
Executed SQL query that results in the average value of orders each
shipper ID was asked to handle.
After the FROM clause, add a JOIN and specify the table to which you want to link.
Finally, specify the field on which you want to link tables, which looks like this:
ON a.column_name, b.column_name
DIRECTIONS
ACTIVITY
DELIVERABLE
Executed SQL query that results in the total value of orders each shipper
was asked to handle.
● Basic Business Statistics, Concepts and Applications by Berenson, Levine, Krehbiel. 13th
Edition. http://a.co/d/j1j1RtQ