WHERE Clause
The WHERE clause is used to filter records based on specified conditions. It is often used to narrow down the result set.
Example: Using WHERE Clause
SELECT Name FROM FreedomFighters WHERE City = 'Chennai';Output:
Returns the Name of all freedom fighters from Chennai.
Do's and Don'ts
Do's
- Use indexed columns in the WHEREclause for better performance.
- Combine multiple conditions with ANDorORfor complex filtering.
Don'ts
- Don't use WHEREwithout understanding the impact on query performance.
- Don't forget to validate user input to prevent SQL injection.