From the course: MySQL Data Analysis

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

The WHERE clause

The WHERE clause

- [Instructor] Up until now, you've been pulling out every record that exists in the columns that you're querying, but sometimes you don't want every record. Sometimes you may only want records that match certain criteria. That type of filtering is accomplished with a WHERE clause. It's one of the most common and most powerful things that you'll do in SQL. The WHERE clause is optional. It's how you're going to communicate to the server which records you want to include in your dataset. The syntax looks like this, WHERE followed by some LogicalCondition that lets the server know which records to include. Here are some examples. WHERE category=Sci-Fi, WHERE amount is greater than 5.99, or WHERE rental_date BETWEEN 2006, January 1st, and 2006, June 1st. These are all very common executions of a WHERE clause, but you'll use so many more throughout your career. This part is really important. WHERE is optional, and it always comes after the FROM, and then before any GROUP BY, HAVING or…

Contents