SQL FOUNDATIONS:Filtering Data with WHERE
Learn how to filter rows in a table using the WHERE clause. By the end of this chapter, you will be able to retrieve specific records based on conditions such as equality, comparisons, and logical operators.
Filtering Data with WHERE
In the previous chapter, we learned how to retrieve data from a table using SELECT.
But real databases often contain thousands or millions of rows.
Most of the time, we only want specific records.
For example:
- Movies released after 2010
- Movies in the Sci-Fi genre
- Movies with rating greater than 8
To do this, SQL provides the WHERE clause.
The WHERE Clause
The WHERE clause filters rows based on a condition.
Basic syntax:
sqlSELECT columnFROM tableWHERE condition;
Filtering Data with WHERE Missions
Solve exercises in sequence to unlock the next mission.