I have this structure of table, let's call person
id | name | table_name |oid
----+-------+-------------+---
1 | James | customer | 5
2 | Smith | employe | 6
So what I want is to create a SQL script that allows me delete the row with id = 5 in the customer table before deleting the first row in the person table.
This is the first time I am facing this situation, so I have no idea how to do this. I've done several searches on Google but I haven't get any appropriate answer, could anyone help me?