FilteringΒΆ

In this section, you will learn how to filter data in SQL. Previously, you learned how to filter data in Sheets. Filtering data is to look at only a subset of rows, based on some column condition. For example, if you have a database containing information for all citizens of the USA, a filter could be applied to look only at residents of Texas. You have already seen how to apply filters in Sheets.

Filtering data in SQL is as simple as using the WHERE keyword. You can append WHERE column_condition to any SQL query, and the result will be filtered only to rows that satisfy the column condition. For example, you might want to look only at bike trips which are at least one hour (3600 seconds).

It is also possible to filter by multiple criteria. For example to look at bike trips which are 60 minutes or more and the member_type is MEMBER, the query would be as below.

Write a query to find the ending station and duration of all of trips by bike number W00153 that lasted over 8 hours.

How many trips started and ended at station 31111?

You have attempted of activities on this page