Filtering helps you narrow down your query results by including only rows that meet specific criteria. This is done using the WHERE
clause.
SELECT column1, column2, ...
FROM table_name
WHERE condition;
SELECT name, marks FROM Students WHERE marks > 80;
This query filters out students whose marks are above 80.
Hereโs a sample table named Products
:
ProductID | Name | Category | Price |
---|---|---|---|
101 | Laptop | Electronics | 55000 |
102 | Mobile | Electronics | 30000 |
103 | Chair | Furniture | 1500 |
104 | Table | Furniture | 2500 |
๐งฉ Your Task: Write a query to show only those products whose category is Furniture
and price is above 2000.
=
: Equal to>
, <
: Greater than / Less than>=
, <=
: Greater or equal / Less or equal!=
or <>
: Not equal toAND
, OR
: Combine multiple conditionsIN
, NOT IN
: Match any (or none) in a listLIKE
: Match a pattern (e.g., 'A%'
for names starting with A)Write a query to fetch employees from the Employees
table who:
Next Topic โก๏ธ: Learn how to filter using BETWEEN
and LIKE
to handle ranges and patterns!
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!