/* Show all foreign key references (table relationships) */ SELECT kcu.table_name, kcu.column_name, tc.constraint_type, ccu.table_name AS ref_table_name, ccu.column_name AS ref_column_name FROM information_schema.table_constraints tc JOIN information_schema.key_column_usage kcu USING(constraint_name) JOIN information_schema.constraint_column_usage ccu USING(constraint_name) WHERE tc.constraint_type='FOREIGN KEY'