Lesson 2: Filtering data

Use of WHERE Statement

To filter certain results from being returned, we need to use a WHERE clause in the query. The clause is applied to each row of data by checking specific column values to determine whether it should be included in the results or no. Using the table Customers data;

customer_id
first_name
last_name
age
country

1

John

Doe

31

USA

2

Robert

Luna

22

USA

3

David

Robinson

22

UK

4

John

Reinhardt

25

UK

5

Betty

Doe

28

UAE

If we wish to get specific details such as a given age range, the WHERE clause can be used for this; SELECT * FROM Customers WHERE age > 23

customer_id
first_name
last_name
age
country

1

John

Doe

31

USA

2

Robert

Luna

22

USA

3

David

Robinson

22

UK

4

John

Reinhardt

25

UK

5

Betty

Doe

28

UAE

Last updated