1

So I know what the all the child foreign keys are by looking

 SELECT *  FROM INFORMATION_SCHEMA.STATISTICS;

However I now need to get what the parents of the foreign keys are called and what tables they are stored in. So I need the SQL to return a table which stores the following data:

| Child Table | Child Column | Parent Table     | Parent Column |
=================================================================
| #_article   | category     | #_category_store | id            |

I have tried using this:

SELECT * FROM information_schema.REFERENTIAL_CONSTRAINTS;

However that only gives me the child table and parent table. I cant then find the parent column.

Dev Daniel
  • 435
  • 1
  • 7
  • 25

0 Answers0