Database Reference
In-Depth Information
Inserting, updating, and deleting data
from tables
In this section, we will play around with data and learn how to insert, update, and
delete data from a table.
Inserting data
So far, we have learned how to create and alter a table. Now it's time to play around
with some data. Let's start by inserting records in the warehouse_tbl table using the
following command snippet:
warehouse_db=# INSERT INTO warehouse_tbl
(
warehouse_id,
warehouse_name,
year_created,
street_address,
city,
state,
zip
)
VALUES
(
1,
'Mark Corp',
2009,
'207-F Main Service Road East',
'New London',
'CT',
4321
);
We can then verify that the record has been inserted by performing a SELECT query
on the warehouse_tbl table as follows:
warehouse_db=# SELECT warehouse_id, warehouse_name, street_address
FROM warehouse_tbl;
warehouse_id | warehouse_name | street_address
---------------+----------------+-------------------------------
1 | Mark Corp | 207-F Main Service Road East
(1 row)
 
Search WWH ::




Custom Search