postgresqlHow do I delete a row in PostgreSQL?
To delete a row in PostgreSQL, the DELETE
statement is used. The DELETE
statement requires the WHERE
clause to identify the row to be deleted.
For example, the following statement deletes a row from the customers
table with customer_id
equal to 5
:
DELETE FROM customers
WHERE customer_id = 5;
No output will be produced after executing the statement.
The parts of the code are as follows:
DELETE
: the keyword used for deleting a rowFROM customers
: the table from which the row is deletedWHERE customer_id = 5
: the condition used to identify the row to be deleted
Helpful links
More of Postgresql
- How do I store an array in a PostgreSQL database?
- How can I use PostgreSQL and ZFS snapshots together?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I extract the year from a PostgreSQL timestamp?
- How do I install and configure PostgreSQL on a Windows machine?
- How can I convert XML data to a PostgreSQL table?
- How do I install PostgreSQL and Zabbix on my system?
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I use PostgreSQL's UPSERT feature?
- How do I use PostgreSQL with Qt?
See more codes...