Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What diffrence bitween these two mysql operators

Tags:

mysql

Can any one tell me What diffrence bitween these two mysql operators :-

<=> and =

Both are getting same results. Are they same in use.

select s.dwt,s.shipnam from tbl_ship s
where s.dwt >= 1 and s.deleted = 'N'
and s.dwt = 11000
group by s.co_cod

and

select s.dwt,s.shipnam from tbl_ship s
where s.dwt >= 1 and s.deleted = 'N'
and s.dwt <=> 11000
group by s.co_cod

Thanks.

like image 253
Bajrang Avatar asked Jun 21 '11 07:06

Bajrang


People also ask

What are the 2 comparison operators?

Comparison OperatorsLess than ( < ) — returns true if the value on the left is less than the value on the right, otherwise it returns false . Greater than ( > ) — returns true if the value on the left is greater than the value on the right, otherwise it returns false .

What is the difference in and & or operator in MySQL?

The difference between AND, OR is that AND evaluates both conditions must be true for the overall condition to be true. The OR evaluates one condition must be true for the overall condition to be true. In the OR result, if name is John then condition will be true. If any row has the age 22, then it will be true.


1 Answers

<=> is NULL-safe equal to operator.

like image 160
Marty Avatar answered Oct 29 '22 18:10

Marty