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

Code Example 1

IF Boolean_expression
BEGIN
    -- Statement block executes when the Boolean expression is TRUE
END
ELSE
BEGIN
    -- Statement block executes when the Boolean expression is FALSE
END

Code Example 2

--Single line if statement
if RTRIM('t') = 't'
	SELECT 'equal to t'
    
--Single line if ... else
if RTRIM('b') = 't'
	SELECT 'equal to t'
else
	SELECT 'not equal to t'
    
-- if you need to exexute multiple lines, use BEGIN...END block
if RTRIM('T') = 't'
	BEGIN
		Select 'equal to t'
		Select 'and another select'
	END

Learn ReactJs, React Native from akashmittal.com