Database - Advanced SQL - Discussion

Discussion :: Advanced SQL - General Questions (Q.No.4)

4. 

A CASE SQL statement is which of the following?

[A]. A way to establish an IF-THEN-ELSE in SQL.
[B]. A way to establish a loop in SQL.
[C]. A way to establish a data definition in SQL.
[D]. All of the above.

Answer: Option A

Explanation:

No answer description available for this question.

Kaushiki Singh said: (Mar 12, 2011)  
I got ucase and lcase but do not understand this case sql, how it establish if-then-else- in sql ?

Abinayaravi said: (Oct 12, 2011)  
This is like switch cases but used in if-then-else.

Hari Krishna Dondapati said: (Feb 18, 2012)  
It is nothing but, it will checks the equality condition like where clause in normal select statement.

If value is true, then it will display corresponding value.

Sanjay said: (Apr 29, 2017)  
But we can use fun.UCase or LCase. Am I right?

Amulya said: (Dec 18, 2017)  
Please explain, if-then_else in sql with an example.

Rakesh said: (Jun 4, 2018)  
In this, we can able to write both if and else conditions ;

SELECT Job,
CASE
WHEN Gender = 'M' THEN 'Male'
WHEN Gender = 'F' THEN 'Female'
ELSE 'Unknown Value'
END
FROM Employee.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.