Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the purpose of the ‘Where’ clause in an SQL statement?

user-image
Question added by Maalik Muhamed , Deputy Mill Manager , AZANIA GROUP OF COMPANYS
Date Posted: 2014/05/07
Afsheen Atif
by Afsheen Atif

The SQL WHERE clause is used to specify a condition while fetching the data from single table or joining with multiple tables.

If the given condition is satisfied then only it returns specific value from the table. You would use WHERE clause to filter the records and fetching only necessary records.

The WHERE clause is not only used in SELECT statement, but it is also used in UPDATE, DELETE statement, etc.

Lts suppose you have a bayt member info table members with  fields  first_name ,status, and so on .

If I need first name of all bayt members with status moderator from its members table I'll Query :

 

SELECT first_name

FROM members

WHERE status="moderator"

 

Cheers!

Bhavana Babu
by Bhavana Babu , Software Engineer , M SQUARED Software And Services

WHERE clause is used to limit the number of rows returned by a query.

 

Geshan Manandhar
by Geshan Manandhar , Quality and Maintenance (QM) Lead , Namshi.com

Where is used to filter the records with conditions. Like if you have10 records5 with city Dubai it can be used as WHERE city = 'Dubai' to get only records where city is Dubai.

Iqbal Ahmed
by Iqbal Ahmed , Solutions Architect , Nami

To filter rows of data

Sheraz Hassan
by Sheraz Hassan , Web Lead Engineer , Farahat & Co

Where clause in SQL is use for conditioning the query

Clodelio Delfino
by Clodelio Delfino , Managing Consultant , Startup Company

Just like with others...it's use as added filter or criteria so as to have a refined result or set of data to capture.

Jay Joshi
by Jay Joshi , Database Developer , Accion Labs [Client: Amway]

A where clause is used to filter our the records in a selection from a table.

When using a where clause, the Select query will only fetch those records from a table that matches the condition in where clause.

الطاهر محمد الطاهر احمد
by الطاهر محمد الطاهر احمد , Information Technology Engineer , Alahtim Agency Travel & Tourism

The WHERE clause is used to filter records.

Be in a lot of database records So you need to order () to work sort of data and extract only the desired ones Go to this link and will greatly benefit

WHERE clause: 

Muhammad Majid Saleem
by Muhammad Majid Saleem , Senior PHP Developer / Project Manager , SwaamTech

All answers are correct.

In simple words, we use WHERE clause to get specific records from database table in SQL.

Basel Abumwis
by Basel Abumwis , Head of Customer Service , The National Bank

the WHERE clause is used to limit the query output to the information that matches the CONDITIONS in the clause.

Nouphal Muhammed
by Nouphal Muhammed , Senior Web Developer , Planet Green Solutions

Usually WHERE clause is used to filter the results returned from a SELECT statement. But it can also be used with INSERT,UPDATE and DELETE. WHERE caluse is accompanied by a condition which will be the filtering criteria. eg: SELECT name FROM student WHERE name='nouphal'  or DELETE FROM student WHERE student_id =4;

More Questions Like This