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 – 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:
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: