I'm new to SQL and PostgreSQL and I'm trying to find a way to create a new table in database where a column will automatically calculate a pre-defined function with data from other columns.
Specifically I want a LOG table with
TIME_IN | TIME_OUT | DURATION columns
where the DURATION column shows the result of (=TIME_OUT - TIME_IN)
Of course this can be done with running a query but I'm trying to figure out if it's possible
to have it pre-defined so whenever running SELECT * FROM log
the table will load up with duration value already calculated according to updated data in IN / OUT columns.