postgresql Basic INSERT


Let's say we have a simple table called person:

    person_id BIGINT,
    name VARCHAR(255).
    age INT,
    city VARCHAR(255)

The most basic insert involves inserting all values in the table:

INSERT INTO person VALUES (1, 'john doe', 25, 'new york');

If you want to insert only specific columns, you need to explicitly indicate which columns:

INSERT INTO person (name, age) VALUES ('john doe', 25);

Note that if any constraints exist on the table , such as NOT NULL, you will be required to include those columns in either case.