What Is Where in SQL?
‘Where’ as a word is used to distinguish a place or position and that’s exactly what the SQL Where clause does. Where in SQL is used to specify a condition while fetching the data. The Where in SQL fetches only the necessary records.
Wish to crack SQL interviews? Intellipaat’s Top SQL Interview Questions are meant only for you!
Watch this Where in SQL video
How to Filter Records with the ‘Where’ in SQL?
Where in SQL is used to filter records on the basis of a condition, or it is used to extract records which satisfy a condition.
In this example, we want to extract those records where the age of a person is more than fifty or sixty out of those records where the occupation of the person is a doctor.
Go for this in-depth job-oriented SQL Training Course now!
Where Clause in SQL Syntax with an Example
SELECT column1, column2, columnN FROM tablename WHERE [condition];
where SELECT, FROM, and WHERE are the keywords; column1 to columnN are a set of columns; tablename is the name of the table, and there is a condition followed by a semicolon.
Visit our SQL Community to get answers to all your queries!
- Let’s display only the employees from the operations department
select e_name,e_dept from employee where e_dept=’operation’;
- After writing the query, click on the execute button to check for errors
- Once the query is executed, the table appears
This bring us to the end of this where in SQL. In the next tutorial section, we will discuss on the imposed operators used with the Where clause, which will help users filter data using multiple constraints.
Enrol yourself for SQL certification and give a head-start to your career in SQL!Previous Next