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 8387863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:19:53+00:00 2026-06-09T18:19:53+00:00

Suppose I have 5 table schemas in memory as DataTables and one other DataTable

  • 0

Suppose I have 5 table schemas in memory as DataTables and one other DataTable that is a schema of the referential constraints between the other 5 tables.

The 5 schema tables are related such that Table A contains a primary key column related to a foreign key in B. B also contains a primary key column related to a foreign key column in C, and C to D, but suppose A,B,C, and D are not directly or indirectly related to E.

What sort of function would take in two datatables and return a boolean value indicating whether those tables were related or ‘linked’.

What I’m Trying To Accomplish

Suppose I present a user with all of the columns in the 5 tables in a drag and drop style interface. I want the user to be able to build a query a graphically, but I will need to enable/disable certain columns based on whether or not they can even be returned in the same select statement.

  • 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-09T18:19:55+00:00Added an answer on June 9, 2026 at 6:19 pm

    You say you have a sixth table containing the constraints between the other tables.

    Assuming you can use this info effectively, and are only trying to map direct relationships, you could probably do something like this:

    • Compile a list of all tables that may contain primary keys that may be referenced from other tables
    • Iterate over each such table X
      • Compile a list L of tables that X could be related to
      • For each primary key K in table X, iterate over each table in L, searching for any reference to K.
      • Break and skip to the next table in L as soon as you encounter a reference to any K
      • Store the info about the relationship somehow (eg. a list of tables from L for each table X)

    I know this is very high-level and abstract, but I hope it makes sense..

    This might take some time to run, depending on the number of tables and complexity of their relationships, but I can’t see any better alternative.

    You might store the info about “forbidden” relationships in for instance a Dictionary with a key and a list for each table; something like this (for one-way relationships, to avoid double-registering the info):

    {TableA => {TableB, TableC}, 
     TableB => {TableC, TableD}, 
     TableC => {}, 
     etc..}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose i have one table that holds Blogs. The schema looks like : ID
Suppose that I have a table with the following schema: tableId field1 field2 .....
Suppose I have table A with a field that can be either 1 or
Suppose I have a table, the first column is an identity. I thought that
I have one data warehouse table that contain one row for each item sold.
Suppose I have a table like that: create table reserved ( id int(4) primary
Suppose I have the following schema: Table: Showing showing_id movie_id theater_id show_date show_time Table:
Suppose I have a table that contains a list of ids pointing to table
Suppose I have table in my DB schema called TEST with fields (id, name,
Suppose I have a table foo with schema (name, age). So the table looks

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.