What is WHERE clause?
Where clause filters the record from a table according to given condition.
RollNo | Name | Fee |
1 | Sameed | 10,000 |
2 | Shahzeb | 10,000 |
3 | Basit | 0.00 |
Table 1: student
Example 1 of WHERE clause
Query:
SELECT * FROM student  WHERE Name = ‘sameed’;
Note: This will display values from all the table WHERE Name is sameed.
Result:
RollNo | Name | Fee |
1 | Sameed | 10,000 |
Query displays the resultant table: student
Example 2 of WHERE clause
Query:
SELECT * FROM student  WHERE Fee = ‘10,000’;
Note: This will display values from all the table WHERE Fee is 10,000.
Result:
RollNo | Name | Fee |
1 | Sameed | 10,000 |
2 | Shahzeb | 10,000 |
Query displays the resultant table: student
Example 3 of WHERE clause
Query:
SELECT * FROM student  WHERE Fee <  10000;
Note: This will display values from all the table WHERE Fee is less than 10,000.
Result:
RollNo | Name | Fee |
3 | Basit | 0.00 |
Query displays the resultant table: student