Im very new to SQL and I wanted to know if I am able to place a comparison operator in the select portion
ex
Select
(value> value1, "True","False") as Comparison
From Table
CodePudding user response:
For SQL Server: You use can IIF
like this:
Select IIF(value> value1, "True","False") as Comparison From Table
For Oracle: use this:
CASE Function:
SELECT CASE WHEN value> value1 THEN 'True' ELSE 'False' END as Comparison From Table
CodePudding user response:
If you try to query in that way it will only return the Boolean values as you are trying to compare between two values. As the "True" and "False" are just string it will print only "True" and "False" You can see in the below image for a reference