Blurbs ansible coffeescript django dvcs erlang es6 hg javascript json lua mercurial peewee postgresql python scope sql sqlalchemy yaml

RETURNING code postgresql sql json

UPDATE questions SET bounty = bounty * 2 WHERE id = 5432
RETURNING bounty;

WITH upd AS (
  UPDATE employees SET sales_count = sales_count + 1 WHERE id = 1
  RETURNING *
)
INSERT INTO elog SELECT row_to_json(upd), current_timestamp FROM upd;

array_to_json code postgresql json sql

SELECT array_to_json(array_agg(books))
FROM (SELECT isbn, author, title FROM my_books) AS books;