"Testing1"
PostgreSQL Insert Data
Adding Single Entry
To contribute a new record to a PostgreSQL table, deploy the INSERT INTO instruction.
INSERT INTO cars (brand, model, year)
VALUES ('Chevrolet', 'Impala', 1967); After executing, the terminal confirms with:
INSERT 0 1
This indicates one entry successfully appended.
🛈 The zero is a placeholder for an internal PostgreSQL process—ignore it for now.
Syntax Insight
- Text elements must appear within 'single quotes'.
- Digits may be entered plainly, without surrounding characters.
Viewing All Records
Retrieve full table contents to verify data with:
SELECT * FROM cars;
This could yield:
brand | model | year ---------+----------+------ Chevrolet | Impala | 1967 (1 row)
Entering Multiple Records
You can register several data lines in one go by including more value sets:
INSERT INTO cars (brand, model, year)
VALUES
('Dodge', 'Charger', 1970),
('Mazda', 'RX-7', 1985),
('Honda', 'Prelude', 1992);Terminal reply:
INSERT 0 3
Signifying three new rows incorporated.
Display Outcome
To cross-check the contents again, rerun:
SELECT * FROM cars;
You’ll now see all records stacked beneath each other.
Prefer Learning by Watching?
Watch these YouTube tutorials to understand POSTGRESQL Tutorial visually:
What You'll Learn:
- 📌 04 How to insert data in PostgreSQL
- 📌 PostgreSQL Insert data in table