On Friday, December 30, 2016, tank.zhang <
6220104@qq.com> wrote:
DB2 operation:
db2 "create table emp(id int,name char(10),salary int,rev_salary integer
generated always as (salary*50/100))"
[db2inst2@db2 ~]$ db2 "insert into emp(id,name,salary)
values(100,'asdf',51100)"
[db2inst2@db2 ~]$ db2 "select * from emp"
ID NAME SALARY REV_SALARY
----------- ---------- ----------- -----------
100 asdf 500 250
100 asdf 6600 3300
100 asdf 51100 25550
*How to use postgresql implement?*
You have to use CREATE VIEW. Possibly with insert/update/delete triggers to interact with the backing table.
David J.