Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:20:09+00:00 2026-06-08T21:20:09+00:00

What can be the possible query for listing all/one the table(s) that are being

  • 0

What can be the possible query for listing all/one the table(s) that are being referenced from a given table please?

Actually I can list the tables which are referenced by a given table with the following query I found on search.

use INFORMATION_SCHEMA;

select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from KEY_COLUMN_USAGE where
REFERENCED_TABLE_NAME = '<table>';

But what I need is the reverse side of this. That is a list of tables that are being referenced from a given table.

Would be great to have a solution.. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:20:10+00:00Added an answer on June 8, 2026 at 9:20 pm

    You can use:

    SELECT TABLE_NAME 
        FROM information_schema.KEY_COLUMN_USAGE 
    WHERE REFERENCED_TABLE_NAME = 'yourtable';
    

    To check which tables link to ‘yourtable’.

    You can use:

    SELECT REFERENCED_TABLE_NAME 
        FROM information_schema.KEY_COLUMN_USAGE 
    WHERE TABLE_NAME = 'yourtable';
    

    to search the other way around. Make sure to use correct foreign key declaration in the create table statement in order for this table to be filled correctly!

    mysql> describe KEY_COLUMN_USAGE;
    +-------------------------------+--------------+------+-----+---------+-------+
    | Field                         | Type         | Null | Key | Default | Extra |
    +-------------------------------+--------------+------+-----+---------+-------+
    | CONSTRAINT_CATALOG            | varchar(512) | NO   |     |         |       |
    | CONSTRAINT_SCHEMA             | varchar(64)  | NO   |     |         |       |
    | CONSTRAINT_NAME               | varchar(64)  | NO   |     |         |       |
    | TABLE_CATALOG                 | varchar(512) | NO   |     |         |       |
    | TABLE_SCHEMA                  | varchar(64)  | NO   |     |         |       |
    | TABLE_NAME                    | varchar(64)  | NO   |     |         |       |
    | COLUMN_NAME                   | varchar(64)  | NO   |     |         |       |
    | ORDINAL_POSITION              | bigint(10)   | NO   |     | 0       |       |
    | POSITION_IN_UNIQUE_CONSTRAINT | bigint(10)   | YES  |     | NULL    |       |
    | REFERENCED_TABLE_SCHEMA       | varchar(64)  | YES  |     | NULL    |       |
    | REFERENCED_TABLE_NAME         | varchar(64)  | YES  |     | NULL    |       |
    | REFERENCED_COLUMN_NAME        | varchar(64)  | YES  |     | NULL    |       |
    +-------------------------------+--------------+------+-----+---------+-------+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Retrieve (or simulate) full query from PDO prepared statement I can't figure
Is this kind of mysql query possible? SELECT power FROM .$table. WHERE category IN
Possible Duplicate: Can I run from command line program created by Eclipse? I am
Is it possible to query the Wikipedia API for articles that contain a specific
Is it possible to query SQL Server 2008 R2 for a list of queries
Is this possible: mysql_query(SHOW VARIABLES LIKE 'query%'); in php? If so how can I
Is it possible to query a collection that is dumped in a heap dump?
Possible Duplicate: Parse query string into an array How can I explode a string
How can be possible to use Google analytic with blogger dynamic views? I cannot
Possible Duplicate: Can main function call itself in C++? I found this problem very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.