PostgreSQL: Insert Query Example

PostgreSQL: Insert Query Example

novicetechie

The INSERT command in PostgreSQL is used to add records to a table. It is part of the Data Manipulation Language (DML) and allows you to insert one or many rows with defined values. :contentReference[oaicite:1]{index=1}

Basic Syntax


INSERT INTO table_name (column1, column2, column3)
VALUES (value1, value2, value3);

If you are inserting values into all the columns of a table in order, you can skip naming the columns:


INSERT INTO table_name
VALUES (value1, value2, value3);

Example — Insert Data


CREATE TABLE employee (
    id BIGINT PRIMARY KEY,
    name VARCHAR(100),
    role VARCHAR(100)
);

INSERT INTO employee VALUES
(1, 'Alice', 'Developer'),
(2, 'Bob', 'Manager');

By grouping rows inside the VALUES clause, you can insert multiple rows in one statement. :contentReference[oaicite:2]{index=2}

Comments

Simple Tech Tips for Everyday Users

Learn easy tech solutions, beginner-friendly tutorials, and simple fixes for your phone, laptop, apps, and internet problems — all in one place.

Explore by Category

About NoviceTechie

NoviceTechie.com is your simple tech helper. We provide beginner-friendly tutorials, how-to guides, and easy troubleshooting tips to make technology easier for everyone — no technical knowledge required.

Latest Posts

Get Simple Tech Tips Weekly

Join our free updates (optional).

Follow Us
NoviceTechie.com — Simple tech tutorials, everyday problem fixes, and easy guides for beginners.