Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Searching Tables with 'WHERE' 7:27
- Searching Tables with 'WHERE' 3 objectives
- Filtering by Comparing Values 3:58
- Filtering by Comparing Values 3 objectives
- Filtering on More than One Condition 2:51
- Filtering on More than One Condition 2 objectives
- Filtering by Dates 2:30
- Filtering by Dates 1 objective
- Searching Within a Set of Values 2:35
- Searching Within a Set of Values 2 objectives
- Searching Within a Range of Values 2:57
- Searching Within a Range of Values 2 objectives
- Finding Data that Matches a Pattern 2:43
- Finding Data that Matches a Pattern 2 objectives
- Filtering Out or Finding Missing Information 1:58
- Filtering Out or Finding Missing Information 2 objectives
- Review & Practice with SQL Playgrounds 3:50
- Need SQL Practice?
- Finding the Data You Want Review 15 questions
Start a free Courses trial
to watch this video
![](https://videos.teamtreehouse.com/stills/TH-SQLBasics-Stage3-Video1-stills-2.jpg?token=6991e88c_b6dc4cfa27203de41627e08f895ea7a5c8cdf4c1)
- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
The real power of SQL comes from filtering rows of information. You've filtered columns, now you're going to filter rows.
SQL Used
A WHERE
Clause
SELECT <columns> FROM <table> WHERE <condition>;
Equality Operator
Find all rows that a given value matches a column's value.
SELECT <columns> FROM <table> WHERE <column name> = <value>;
Examples:
SELECT * FROM contacts WHERE first_name = "Andrew";
SELECT first_name, email FROM users WHERE last_name = "Chalkley";
SELECT name AS "Product Name" FROM products WHERE stock_count = 0;
SELECT title "Book Title" FROM books WHERE year_published = 1999;
Inequality Operator
Find all rows that a given value doesn't match a column's value.
SELECT <columns> FROM <table> WHERE <column name> != <value>;
SELECT <columns> FROM <table> WHERE <column name> <> <value>;
The not equal to, or inequality operator, can be written in two ways !=
and <>
. The latter is less common.
Examples:
SELECT * FROM contacts WHERE first_name != "Kenneth";
SELECT first_name, email FROM users WHERE last_name != "L:one";
SELECT name AS "Product Name" FROM products WHERE stock_count != 0;
SELECT title "Book Title" FROM books WHERE year_published != 2015;
See all of the SQL used in SQL Basics in the SQL Basics Cheat Sheet.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
JASON LEE
17,352 Points1 Answer
-
A X
12,842 Points2 Answers
-
pratyush raj
7,097 Points1 Answer
-
Ashley Chenn
8,329 PointsI'm brand-spanking-new to SQL. Any recommendations on tools to build and store a SQL database?
Posted by Ashley ChennAshley Chenn
8,329 Points1 Answer
-
Mohammed Safa
639 Points2 Answers
-
Magnus Rydberg
4,683 Points1 Answer
-
Robert Close
3,383 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up