H I O X INDIA
MySQL Tutorial
Google
Web hscripts.com
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
Feedback





Comparison Operators


Topic

How to select data from MySQL using Comparison Operators?
How to use Comparison operator in MySQL?



Explanation


Comparison Operator :

    Comparison operator is used to compare expressions or values. The result of the comparison will be either True(1) or False(0). MySQL supports the following comparison operators :

= :

    Equal.

mysql> select 1 = 0;
 -->  0

mysql> select 0.0 = 0;
 -->  1
< :

    Less than.
mysql> select 4.5 < 5;
 -->  1

mysql> select 1.1 < 1;
 -->  0
<= :

    Less than or equal.
mysql> select 2.2 <= 2.2;
 -->  1

mysql> select 2.2 <= 2.1;
 -->  0
> :

    Greater than.
mysql> select 7 > 2;
 -->  1

mysql> select 4 > 4.1;
 -->  0
>= :

    Greater than or equal.
mysql> select 10 >= 10;
 -->  1

mysql> select 4.4 >= 4.5;
 -->  0
<>, != :

    Not equal.
mysql> select 8 <> 8;
 -->  0

mysql> select 7 != 7.7;
 -->  1
expr BETWEEN min AND max :

    If expr is greater than or equal to min and expr is less than or equal to max, BETWEEN returns 1, otherwise it returns 0.
mysql> select 5 between 5 and 6;
 -->  1

mysql> select 'N' between 'M' and 'O';
 -->  1
    This is same for the expr NOT BETWEEN min AND max, but Not.

GREATEST(value1,value2,...) :

    This operator returns the largest argument, compared with two or more arguments.
mysql> select greatest('N', 'M', 'O');
 -->  O

mysql> select greatest(1, 2);
 -->  2
    The same rule is applied in finding the LEAST().



others


        MySQL is the most popular open source database Management system. Being a open source anyone can use and change the software for their needs. Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this MySQL tutorial. This is a copyright content.


privacy policy     license     sitemap
© 2004-2005 HIOX INDIA - hioxindia.com

Other Links