Check out example codes for "mysql if else". It will help you in understanding the concepts better.

Code Example 1

select id, 
    (
    CASE 
        WHEN qty_1 <= '23' THEN price
        WHEN '23' > qty_1 && qty_2 <= '23' THEN price_2
        WHEN '23' > qty_2 && qty_3 <= '23' THEN price_3
        WHEN '23' > qty_3 THEN price_4
        ELSE 1
    END) AS total
 from product;

Code Example 2

SELECT 
  IF(500<1000, "YES", "NO");

Code Example 3

IF condition THEN
   statements;
ELSE
   else-statements;
END IF;

Code Example 4

IF condition1 THEN
    statements;
ELSEIF condition2 THEN # OPTIONAL
	statements;
ELSE # OPTIONAL
    statements;
END IF;

Learn ReactJs, React Native from akashmittal.com