Complete the code to insert a new user and return the inserted id.
INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com') [1] id;
The RETURNING clause in PostgreSQL allows you to get the inserted row's columns immediately after an INSERT.
Complete the code to insert a product and return both id and name.
INSERT INTO products (name, price) VALUES ('Book', 9.99) [1] id, name;
Use RETURNING to get multiple columns from the inserted row.
Fix the error in the code to return the inserted row's email.
INSERT INTO customers (name, email) VALUES ('Bob', 'bob@example.com') [1] email;
The correct keyword to return inserted columns in PostgreSQL is RETURNING.
Fill both blanks to insert a new order and return order_id and total.
INSERT INTO orders (customer_id, total) VALUES (123, 45.67) [1] [2];
Use RETURNING followed by the columns you want to get back, separated by commas.
Fill all three blanks to insert a new employee and return id and name.
INSERT INTO employees (name, department, salary) VALUES ('Eve', 'HR', 60000) [1] [2] [3];
The RETURNING clause is followed by the columns you want to get back. Separate columns with commas. Here, id, name are returned (note the commas).