Mysql

MySQL Where Clause

A WHERE Clause is an SQL query to apply a filter on the rows retrieved.
When a WHERE Clause is added to MySQL query, the MySQL engine compares each record in the table with the condition specified in the WHERE Clause.The MySQL engine display only those records that satisfy the specified condition.
Syntax:

SELECT * FROM tablename where condition;

MySQL table(tblemployee)

idEmp_NameEmp_CodeEmp_DesignationEmp_joinnig_date
1Anuj Kumar10806121Software Developer2018-02-01
1Sanjeev Kumar10806860Software Testing2015-10-15
1Rahul Singh10806865HR2016-12-22
1John Doe13406121Accountant2019-03-01

Ex:

Select Emp_Name  from tblemployee where id=1;

Output
Anuj Kumar
Operators in the where clause :
 

OperatorDescription
=Equality
!=Inequality
<Less than
<=Less than or equal
>More than
>=More than or equal
Between minWithin the range
AND maxmin to max
IS NULLIs a NULL Value
IS NOT NULLIs not a null value

Comparison operators are used in a query with a WHERE clause to test if a specified condition is met. When the evaluation is TRUE the query will return the data, otherwise nothing will be returned.
MySQL 5.6 reference manual online at dev.mysql.com/doc

Recommended Tutorials for you


Tags

Anuj kumar

This is Anuj Kumar. I’m a professional web developer with 5+ years of experience. I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to provide PHP, Jquery, MySQL, PHP Oops and other web development tutorials. .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Check Also
Close
Back to top button
Close
Close