I wish to write a query that will return a list of foreign keys and the table to which they pertain.
- Given a table of 'customers' and a table of 'accounts', in which each customer can have 1 or more accounts
- The FK in accounts is a customer_id
How would I write a query to list the foreign key(s) in the accounts table along with the table to which said foreign key relates.
I want to query the 'accounts' table, so as to retrieve the customer_id as the FK and the customers table as the table linked to this FK.