If your program often needs such case constructors, you can create your own set of functions that will have user-defined functions, such as Bool_IsGreater(left, right) , which will return you your zero 0 or 1.
SQL Server does not support boolean type in any case, even for using a base column.
If you need performance, and these values โโ5 and 3 will naturally come from some select query, you can create a new column and set its value to 1 or 0 using a trigger or something else that can help in performance.
Valentin kuzub
source share