Share This Post, Help Others, And Earn My Heartfelt Appreciation! :)

In this page we will focus on the SQL WHERE Syntax Complete online training. You will learn how to use WHERE when you would like to filter one specific value using equals(=) or multiple by (IN) syntax.

SQL WHERE Syntax Complete online training

SQL WHERE Syntax – is used to filter data by specific criteria. We use this syntax when we want to restrict, filter out data because we would like to present our calculations for only one specific case.

Another case is if we want to clean the input data, because it contains some bad cases, null values, or the values which are not valid.

Filter data by Country

Now we would like to present data for only one specific country = ‘Poland’

SELECT * from sales_report WHERE country  = 'Poland';

The example output is:

SQL WHERE Syntax Complete online training

WHERE with IN

What if we only want to show data for 3 specific countries? We can use the SQL WHERE syntax with IN condition.

SELECT * from sales_report WHERE country IN ('Poland','France','Australia');

The following table sows the sample results of above SELECT statement:

SQL WHERE Syntax Complete online training
SQL WHERE multiple conditions

How useful was this post?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 6

No votes so far! Be the first to rate this post.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments