Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Inserting and updating NULLs
Conditions in UPDATE and DELETE
Updating the list of columns in one query
Using values from another column
Return rows in INSERT, UPDATE, DELETE
19. Display values when inserting multiple rows
Summary

Instruction

Great! The RETURNING clause can also be used in an INSERT query with multiple rows:

INSERT INTO student VALUES
  (14, 'Sandra', NULL, 'Norman'),
  (15, 'Martin', 'Gary', 'Kline')
RETURNING *;

The statement above inserts two records using just one operation. With RETURNING, you can display all the inserted data.

Exercise

Insert two new students into the student table: Joanna Maria Pearson with id = 16 and John Porter (who doesn't have a middle name) with id = 17. Display the inserted data.