O'Reilly logo

Learning PostgreSQL by Andrey Volkov, Achim Vannahme, Salahaldin Juba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing the data in the database

Data can be inserted into database tables, updated or deleted from the database. Respectively, statements are used for this: INSERT, UPDATE and DELETE.

INSERT statement

The INSERT statement is used to insert new data into tables in the database. The records are always inserted into only one table.

The INSERT statement has the following syntax:

INSERT INTO <table_name> [(<field_list>)]
{VALUES (<expression_list>)[,...]}|{DEFAULT VALUES}|<SELECT query>;

The name of the table into which the records are inserted is specified after the INSERT INTO keywords. There are two options for using the INSERT statement, which have different syntax: to insert one or several individual records, or to insert the whole dataset of many ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required