Uploaded by vinay peddi

WHERE clause sql

advertisement
The Art of Using
WHERE clause in SQL
for Data Filtering
- Ayan Khan
1
Basic Filtering
- WHERE clause is often used to
filter rows based on specific
conditions.
- select * from employees
where department = 'Sales';
/AYAN KHAN
2
Comparison Operators
- WHERE clause utilize various
comparison operators to
perform conditional filtering.
- select * from products
where price > 100;
- select * from customers
where age <= 30;
/AYAN KHAN
3
Multiple Conditions
- WHERE clause combine
multiple conditions using logical
operators like AND and OR.
select * from students where
grade = 'A' and age > 18;
select * from inventory where
quantity < 10 or status = 'Out of
Stock';
/AYAN KHAN
4
Pattern Matching
- WHERE clause use pattern
matching operators like LIKE
and wildcard characters '%' to
match specific patterns in text
columns.
- select * from products where
product_name like 'Apple%';
- select * from customers
where last_name like 'mith%';
/AYAN KHAN
5
Subqueries
- WHERE clause incorporate
subqueries to perform more
complex filtering based on
results from other queries.
- select * from employees
where department_id in (select
department_id from
departments where location =
'New York');
/AYAN KHAN
What topics would
you like me to cover
in my next post?
Follow for more!
/AYAN KHAN
Download