OPERATORS

bodmas 3000

Logical

SELECT 1=1, 1<1, 1>1, 1<=1, 1>=1;

 ?column? | ?column? | ?column? | ?column? | ?column? 
----------+----------+----------+----------+----------
 t        | f        | f        | t        | t

SELECT 1<>1; 
 ?column? 
----------
 f
 
SELECT 1 = 1 or 1 = 2 ;
 ?column? 
----------
 t

select 1 / 0;
-- ERROR:  division by zero

Pattern Matching

Tips

  • When using AND and OR in sample SQL statement, use brackets to differentiate between statements

  • AND operator is processed before OR operator

  • SQL treats AND operator like multiplication and OR like divide

Fetch

IS NULL or IS NOT NULL

Last updated

Was this helpful?