Delete records where count of a related records in another table matches a condition

Advertisements I have two tables with the following schema: table1 ( id UUID UNIQUE NOT NULL PRIMARY KEY, … ); table2 ( id UUID UNIQUE NOT NULL PRIMARY KEY, table1_id UUID NOT NULL FOREIGN KEY REFERENCES table1(id), … ); I would like to delete all records in table 1 where the count of related records… Read More Delete records where count of a related records in another table matches a condition

How to delete only one row from non unique set of rows in Postgres?

Advertisements I have this table create table order_details( id_of_product integer, id_of_person text ) both fields are not unique. How to delete one row from the table with specified id_of_product and id_of_person for example i need to delete one row with id of 6 P.S person is the same for this set of rows >Solution :… Read More How to delete only one row from non unique set of rows in Postgres?