Database Reference
In-Depth Information
(
warehouse_id,
warehouse_name,
year_created,
street_address,
city,
state,
zip
)
VALUES
(
3,
'West point',
2013,
'Down Town',
'New London',
'CT',
4321
);
We can then delete data from the
warehouse.tbl
table, where
warehouse_name
is
Bill & Co
, by executing the following statement:
warehouse_db=# DELETE FROM warehouse_tbl
WHERE warehouse_name='Bill & Co';
To verify that a record has been deleted, we will execute the following
SELECT
query:
warehouse_db=# SELECT warehouse_id, warehouse_name
FROM warehouse_tbl
WHERE warehouse_name='Bill & Co';
warehouse_id | warehouse_name
--------------+----------------
(0 rows)
The
DELETE
command is used to drop a row from a table, whereas
the
DROP
command is used to drop a complete table. The
TRUNCATE
command is used to empty the whole table.