0

I am not strong in DB knowledge, especially Postgresql. So the istuation is: I have two columns in a table num_bigger and num_lower. I need to make a third column that is

elapsed = num_bigger - num lower

I've googled it and figured out that the best way to do this is to make a view(Also I found how to do this using triggers, but they are not allowed for me). Any suggestions how to make this kind of view ?

1 Answer 1

4

Just use that expression in a SELECT statement:

select num_bigger, 
       num_lower,
       num_bigger - num_lower as elapsed
from the_table;

If you want to make a view out of it, then use:

create view some_view_name
as
select ....;

More details in the manual:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.