SQL select default parameter I have a table with columns like name, age, email etc. For some columns I also have parameters to control the behaviour of queries. I want to show the column's value if the corresponding parameter has the value 0. If that parameter has value 1 I don’t want to show that column.

For example, if I have data

name  age  show_email  email
abc,  22   1           abc@gmail.com  -- parameter = 1 do not show this value
def,  33   0           def@gmail.com  -- parameter = 0 =&gt; show this value


Then output of select name, age, email from MyTable1 will be

name  age  email
abc,  22   NULL          -- NULL because of parameter value.
def,  33   def@gmail.com
Use the case statement 

select name, age,
 case show_email when 0 then email else null end
from my_table;