PostgreSQL Insert
PostgreSQL Insert
The INSERT statement is used to insert records into a table from a PostgreSQL database.
Insert syntax
INSERT INTO table_name ( column name1, column name2, column name3, ... ) VALUES ( value1, value2, value3, ... ); INSERT INTO table_name (column name1, column name2, column name3, ...) VALUES (col_value1,col_value2,col_value3,...), (column name1, column name2, column name3, ...) VALUES (col_value1,col_value2,col_value3,...);
Insert example
INSERT INTO goods (id, good_type, name, description, price, insert_date) VALUES (1, 'A', 'Car_1', 'Car 1 description', 100, now()); INSERT INTO goods (id, good_type, name, description, price, insert_date) VALUES (2, 'A', 'Car_2', 'Car 2 description', 200, now()), (3, 'A', 'Car_3', 'Car 3 description',100, now()), (4, 'B', 'Boat_4', 'Boat 4 description', 500, now()), (5, 'B', 'Boat_5', 'Boat 5 description', 300, now()), (6, 'C', 'Train_1', 'Train 123 description', 800, now());