Create hierarchical query to traverse tree and delete records based on primary key
I recently started a new job and one requirement that I need to work on is deleting select customer data from out test and development systems. This is a contractual obligation.
We don't have a customer_id field on every table that has customer data. If we did this would be much easier. But we do have foreign keys and customer_id fields on many tables.
Ideally I would like to write a hierarchical query that will give me all of the tables that I need to delete data from as well as the primary keys. I can then travel up the tree to get the