I am running the following version of Postgres on CentOS 7:
PostgreSQL 9.6.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit
I am new to database operations and need some help understanding if/how I should do the following:
I have a single table "Table1" that has three columns of data:
| timestamp | Value1 | Value2 |
The Value1 and Value2 columns contain decimal values like the below:
| 1.6732 | 2.78093 |
I have around a million rows of data in this table.
I would like to be able to deduct Value1 from Value2 and insert the result of this calculation in a new column in the same table, so that the table permanently stores the computed value and ends up looking like the below.
timestamp | Value1 | Value2 | Value3
I am not sure if I can or should do this, and if it is possible, how I would create a query to make this happen.
Please can anyone give any advice, examples or pointers on how I should go about doing this or point me in the right direction of how I can learn to do this myself?