In various SQL dialects, the RETURNING clause allows to return data from an INSERT, UPDATE or DELETE.
Is something like this possible? INSERT INTO Table2 (val) VALUES ((INSERT INTO Table1 (name) VALUES ('a_title') RETURNING id)); like …
postgresql sql-returningI have the following UPSERT in PostgreSQL 9.5: INSERT INTO chats ("user", "contact", "name") VALUES ($1, $2, $3), ($2, $1, NULL) ON CONFLICT("user", "contact") DO …
sql postgresql upsert sql-returningI want to insert data into 3 tables with a single query. My tables looks like below: CREATE TABLE sample ( id …
sql postgresql common-table-expression sql-insert sql-returningI try to do this, but it's a syntax error, what am I doing wrong? declare myid := insert into oameni …
sql postgresql sql-returningMy query is as follow: UPDATE t1 SET t1.foreign_key = (SELECT id FROM t2 WHERE t2.col = %s ) WHERE …
sql postgresql sql-update sql-returningIs the function below good? CREATE FUNCTION password_set(bigint, char) RETURNS boolean AS $$ UPDATE users SET password = $2 WHERE id = $1 …
postgresql sql-update boolean sql-returningI've got this table (generated by Django): CREATE TABLE feeds_person ( id serial PRIMARY KEY, created timestamp with time zone …
sql django postgresql upsert sql-returningI think I understand how PostgreSQL and RETURNING works - I've found many, many resources. If I'm catching on, it …
php postgresql sql-returningI have PostgreSQL 9 database that uses auto-incrementing integers as primary keys. I want to duplicate some of the rows in …
sql postgresql sql-insert sql-returningI want to return the primary key from an oracle merge query. I'm using a single statement to insert if …
oracle merge oracle10g sequence sql-returning