1
votes

I'm am inserting rows from one table to another using presto, and would like the inserted rows to be returned. Something like this...

Something like:

insert into animals    
select * from arriving_animals
returning *

It appears returning is not supported in presto. Any advice on how to return the rows that are inserted within the same statement?

1

1 Answers

0
votes

Create a "temporary" table with the rows to insert:

CREATE TABLE tmp_insert AS
SELECT * FROM arriving_animals

Then insert them:

INSERT INTO animals
SELECT * FROM tmp_insert

You can now read the inserted rows and drop the table when finished.