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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:12:44+00:00 2026-05-20T16:12:44+00:00

I posted a week or so about a database structure that I am trying

  • 0

I posted a week or so about a database structure that I am trying to build. I didn’t quite get into the complexity of it, so that’s why I’m reposting. In the example, I used a CD collection as an example.

I understand that I need a lookup table for say my genres or publishers. That’s not a big deal to manage.

But there are eight lookup tables in this project and some of the tables have 150 entries in them. As I understand what was suggested, I need a separate entry for CD and its permutations of data. So if I have say 20 entries on average in a lookup table, that’s 20 x 20 x 20 x 20 x 20 x 20 x 20 x 20 permutations per CD. Or am I misunderstanding? How can I effectively create a master table to pull in all of the data without have a separate row for each permutation. Do I need to write some more complex SQL to manage all of this?

Help!

  • 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-05-20T16:12:44+00:00Added an answer on May 20, 2026 at 4:12 pm

    A brief overview of linking tables in SQL using the CD example.

    Each disc can only have 1 label. We create a table of labels that looks like this:

    Label Table
    
    LabelID     INT(11) NOT NULL auto_increment PRIMARY KEY,
    LabelName   VARCHAR(255) NOT NULL, 
    

    Then in the CD table we have the external reference to the Label

    In CD Table
    
    LabelID     INT(11) NOT NULL,
    

    When we want to see the results we do a join… like this:

    select *
    from CD 
    join Label on CD.LabelID = label.LabelID
    

    One to many.

    Lets say you have a one to many relationship then you need a joining table (I believe this is where you were getting confused.)

    Fist we have the artist table for all artist available (note there can be more data in the artist table — dob, home town… etc.

    Artist Table
    
    ArtistID     INT(11) NOT NULL auto_increment PRIMARY KEY,
    ArtistName   VARCHAR(255) NOT NULL DEFAULT ''
    

    Then we create a joining table. This will join one CD to many artists. A CD can have one or more rows in this table representing each link to an artist on the CD.

    CD2Artist Table
    
    CDID    INT(11) NOT NULL,
    ArtistID INT(11) NOT NULL
    

    Of course we need an ID for the CD for this to work.
    In CD Table

    CDID     INT(11) NOT NULL auto_increment PRIMARY KEY
    

    Then to select a list of artists for a particular CD you say

    SELECT artist.artistname 
    from cd2artist
    join artist on cd2artist.artistID = artist.artistID
    where CDID = <put cd id here>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to solve this problem for about a week now. I posted
Possible Duplicate: Linq: “Or” equivalent of Where() I posted a question about a week
I have a similar question posted, but did not quite get the answer I
Ok, Last time I posted this (last week), I didn't describe the problem correctly.
I posted a question last week on how i can build dependent modules and
I posted a question here last week about using Ajax with J2EE and got
I posted about this a week or so ago but since then I've done
I posted quite recently about an issue with javascript in firefox, and it was
Earlier this week I posted a question about how to effectively share files amongst
I posted a question about keys yesterday, and got very helpful responses. I've been

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.