postgresql 获取修改列的值

使用returning

CREATE TABLE users (firstname text, lastname text, id serial
primary key);
INSERT INTO users (firstname, lastname) VALUES ('Joe', 'Cool')
RETURNING id;
INSERT INTO users (firstname, lastname) VALUES ('Frank', 'Ben')
RETURNING id;

 delete的时候会把删除的行返回

 DELETE from users RETURNING *;

 

posted @ 2018-04-03 16:08  uptothesky  阅读(218)  评论(0编辑  收藏  举报