agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: tank.zhang <6220104@qq.com>
To: pgsql-sql@postgresql.org
Subject: How to use postgresql generated generated always COLUMN ?
Date: Fri, 30 Dec 2016 21:29:48 -0700 (MST)
Message-ID: <1483158588371-5936872.post@n3.nabble.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

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?*


Thank you!



--
View this message in context: http://postgresql.nabble.com/How-to-use-postgresql-generated-generated-always-COLUMN-tp5936872.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (3+ messages)  latest in thread

Message-ID: <1483158588371-5936872.post@n3.nabble.com>
Permalink:  ../1483158588371-5936872.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1483158588371-5936872.post@n3.nabble.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: 6220104@qq.com
  Subject: Re: How to use postgresql generated generated always COLUMN ?
  In-Reply-To: <1483158588371-5936872.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox