Adding new Column containing values based on condition

Hi ,

I want to add a new column with values populated based on values from existing column. How can I include the condition. Looking forward for your suggestion.


I know that we can add a column but I am struggling to find if we can add values to the new column based on values from existing column. Hoping to get a solution.


Hello @sajjan.jindal,

What specifically are trying to accomplish? You can create computed columns for a number of cases. For example, below we are multiplying 2 values in a row and placing the result in a new column:

SELECT name, id, sales_per_quarter * average_sale AS average_sales_per_quarter 
FROM sales_table

Thx for your response - I was able to use the case statement and add new columns