MySQL IF() Nested Function Example

MySQL IF() Nested Function Example

Open your MySQL Query Editor then copy & paste the below code to get the value of IF() Nested MySQL Function:

   SELECT  IF(greatest(2,3,4) > least(6,5,4), 'GREATEST() Wins', 'LEAST() Wins') AS Results;
   --
   SELECT  IF(greatest(2,3,4) < least(6,5,4), 'GREATEST() Wins', 'LEAST() Wins') AS Results;
   --
   SELECT IF(ISNULL(NULL), 'Shit It Is NULL', 'WoW Not NULl') AS Results;
   --
   SELECT IF(1,11,22), IF(IF(1,11,22),111,222), IF(IF(IF(1,11,22),111,222),NULL,2222) AS Results;

   -- MySQL IF() Function Compares Three Expressions
   --
   -- if    [Expression1/Value1] evaluates to true, returns [Expression2/Value2]
   -- else  [Expression3/Value3]

      -- is comment in MySQL
      -- in fact it is comment in MSSQL and Oracle as well
   

MySQL IF() Nested Function Example - Result in MySQL Query Editor

 

Related Tutorial Examples

  1. MySQL IFNULL() Function NULL Value Example
  2. MySQL IF() Function Boolean Value Example
  3. MySQL IF() Function NULL Value Example
  4. MySQL IF() Function Datetime Value Example
  5. MySQL IF() Function String Value Example
  6. MySQL IF() Function Number Value Example
  7. MySQL Stored Procedure Function: Making hello world Function using aliase Example
  8. MySQL Stored Procedure: Creating Table using Stored Procedure Example
  9. Parentheses in SQL Command MySQL Example
  10. Aliase column name in SQL Command MySQL Example

No comments:

Post a Comment

leave your comments here..