what is Comparison Operator?

Comparison operators are used in the WHERE clause to determine which records to select.

= :-Equal
<=> :-Equal (Safe to compare NULL values)
<> :-Not Equal
!= :-Not Equal
> :-Greater Than
>= :-Greater Than or Equal
< :-Less Than
<= :-Less Than or Equal
IN ( ) :-Matches a value in a list
NOT :-Negates a condition
BETWEEN :-Within a range (inclusive)
IS NULL :-NULL value
IS NOT NULL :-Non-NULL value
LIKE :-Pattern matching with % and _
EXISTS :- Condition is met if subquery returns at least one row

not equal to (<>, !=) operator

SELECT id,name,country FROM Empployee WHERE country <>"India";

GREATEST() function

GREATEST() function returns the greatest of the given arguments.

SELECT item_name FROM items WHERE price>GREATEST(200,300,395);

COALESCE() function

MySQL COALESCE() function returns the first non-NULL value of a list, or NULL if there are no non-NULL values.

SELECT pub_NAME,COALESCE(estd,country,pub_city) FROM newpublisher;
select id,title,date from ittutorial where COALESCE(title,'')<>'W'
select id,title,date from ittutorial where title IS NULL OR title=''";





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here


Ittutorial