Reputation: 57
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 ?
Upvotes: 0
Views: 37
Reputation:
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:
Upvotes: 4