...

/

Restricting the Specific Rows

Restricting the Specific Rows

Learn how to use conditions on values to display restricted data.

Use of the where clause

The select statements returned all the customers stored in our customers table. This isn’t usually the case, though. Generally, the customers table contains many rows, the majority of which we aren’t interested in listing. We usually want to retrieve a subset of the customers that satisfy specific criteria.

Let’s suppose that we want to retrieve the customer named John Woo. To do that, we have to use the where clause. The where clause is used with the select statement after the table’s name from which we want to retrieve data.

Try the following command.

Press + to interact
select * from customers where name = 'John Papas';

After we run the query above in the terminal, we get the following output:

1 +----+------------+
2 | id |  name      |
3 +----+------------+
4 |  2 |  John Papas|
5 +----+------------+
6 1 row in
...
Access this course and 1400+ top-rated courses and projects.