Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Maalik Muhamed , Deputy Mill Manager , AZANIA GROUP OF COMPANYS
Date de publication: 2014/05/07

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
par 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
par 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
par Iqbal Ahmed , Senior Application Architect , Nami Pay

To filter rows of data

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

Where clause in SQL is use for conditioning the query

Clodelio Delfino
par 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
par 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.

الطاهر محمد الطاهر احمد
par الطاهر محمد الطاهر احمد , 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
par 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
par 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
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?