Where Clause with Logical Operators
To fetch records of Employee with ages equal to 24.
Query:
SELECT * FROM Emp1 WHERE Age=24;
Output:
To fetch the EmpID, Name and Country of Employees with Age greater than 21.
Query:
SELECT EmpID, Name, Country FROM Emp1 WHERE Age > 21;
Output:
SQL | WHERE Clause
WHERE keyword is used for fetching filtered data in a result set. It is used to fetch data according to particular criteria. WHERE keyword can also be used to filter data by matching patterns.
Syntax:
SELECT column1,column2 FROM table_name WHERE column_name operator value;
Parameter Explanation:
- column1,column2: fields in the table
- table_name: name of table
- column_name: name of field used for filtering the data
- operator: operation to be considered for filtering
- value: exact value or pattern to get related data in result