Answers for "how ot inser t data in postgres table"

SQL
6

return insert results in POSTGRESQL

# to select specific columns
INSERT INTO users (firstname, lastname) VALUES ('Joe', 'Cool') RETURNING id, firstname;
# to return every column
INSERT INTO users (firstname, lastname) VALUES ('Joe', 'Cool') RETURNING *;
Posted by: Guest on June-11-2020
0

POSTGRES INSERT INTO TABLE VALUE FROM OTHER TABLE

##fetch data from other table with sub-query to insert it into another one

INSERT INTO PUBLIC."MyTable"(conversion_job_id, message, last_status)
VALUES (17, 'test', (SELECT status FROM PUBLIC."OtherTable" WHERE id=17))
RETURNING *
Posted by: Guest on August-10-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language