Where Clause
Written By Bear
The WHERE clause is used to filter rows to specified condition(s).
Where can be used with SELECT, UPDATE, or DELETE .
SQL Where Clause Syntax:
SELECT Column1
FROM Table_Name
WHERE condition;
Example:
Lets find all the products with the price above $1000 from the “Products” table.
ProductID | ProductName | Description | Price | SupplierName | SupplierID |
---|---|---|---|---|---|
1 | Super Printer | 9000 series printer | 300 | TechOne | 1 |
2 | Laptop 5 | 4000 Laptop 5th generation | 700 | TechTwo | 2 |
3 | 3D Printer | 3D Print Pro | 900 | TechOne | 1 |
4 | Labtop 7 | 100 Labtop 7 processor | 1200 | TechTwo | 2 |
5 | Camera 400 | Camera Ultra 400 | 400 | TechThree | 3 |
SELECT
ProductID,
ProductName,
Description,
Price,
SupplierName,
SupplierID
FROM Products
WHERE Price > 1000
Results:
ProductID | ProductName | Description | Price | SupplierName | SupplierID |
---|---|---|---|---|---|
4 | Labtop 7 | 100 Labtop 7 processor | 1200 | TechTwo | 2 |
SQL Tutorial