Verified Commit b7546d82 authored by yuki_chen's avatar yuki_chen
Browse files

add description for RETURNING

parent 84bdcfb8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2,3 +2,10 @@

Source Code: [Main.java](./Main.java)

There is a non-standard SQL `RETURNING`:

Offical Document: Search `RETURNING` in https://www.postgresql.org/docs/13/sql-insert.html

It's very useful when you are using serial as primary key as most relational database design dose. If you want to retrive the auto-increment id of the row you inserted just now, simply append `RETURNING column_name` to the INSERT clause.