Combining WHERE clauses

So far, we've used a single condition in all of our WHERE clauses. But sometimes we would like more than one condition. For instance, we might want to find all red Skodas. We can do this by using the AND operator to combine two conditions:

SELECT licensePlate, color, manufacturer FROM cars
WHERE color = 'red' AND manufacturer = 'Skoda'

We can also use the OR operator to find rows that satisfy at least one condition. For instance, to find cars that are red or green:

SELECT licensePlate, color FROM cars
WHERE color = 'red' OR color = 'green'

Task

What your results should look like

Query

Result

There was an error in your SQL query: {{error}}

{{executedQuery}}

Correct answer. Bonza!

Congratulations! You've completed all of the tasks in this lesson.

Next lesson: Sorting results using ORDER BY

Wrong answer. Have another a go.

Hint: {{hint}}

Next lesson: Sorting results using ORDER BY

Once you think you've nailed this lesson, feel free to go to the next lesson.

Next lesson

Questions? Suggestions?

We'd love to hear any feedback you have for us. Just send an email to hello@learnsomesql.com.