Deleting a Record from a Postgres Database

Sunday, October 03, 2021

Have you ever wondered how to delete a record from a Postgres database using the primary ID or any column in the table?

Let me show you how:

DELETE from {table_name} WHERE {table_column eg. id} = '{value}';

eg

DELETE from public.user WHERE id = '35445c3b-2093-4f86-b310-b9273b986595'

NOTE: The value must be enclosed in single quotes if it’s a string

That’s it.

Powered By Swish