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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:52:25+00:00 2026-05-26T16:52:25+00:00

Could someone give me an idea how to create this database structure. Here is

  • 0

Could someone give me an idea how to create this database structure.
Here is an example:

Table "countries":
id, countryname
1, "US"
2, "DE"
3, "FR"
4, "IT"

Now I have another table “products” and in there I would like to store all countries where this product is available:

Table "products":
id,productname,countries
1,"product1",(1,2,4) // available in countries US, DE, IT.
2,"product2",(2,3,4) // available in countries DE, FR, IT.

My question:
How do I design the table structure in “products” to be able to store multiple countries?

My best idea is to put a comma-separated string in there (i.e. “1,2,4”), then split that string to look up each entry. But I doubt that this the best way to do this?

EDIT: Thank you all for your help, amazing! It was difficult to choose the right answer,
I finally chose Gregs because he pointed me to a JOIN explanation and gave an example how to use it.

  • 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-26T16:52:26+00:00Added an answer on May 26, 2026 at 4:52 pm

    You need an intersection table for that many-to-many relationship.

    Table Country
    CountryID, CountryName
    
    Table CountryProduct
    CountryID, ProductID
    
    Table Product
    ProductID, ProductName
    

    You then Inner Join all 3 tables to get your list of Countries & Products.

    Select * From Country 
    Inner Join CountryProduct On Country.CountryID = CountryProduct.CountryID 
    Inner Join Product On CountryProduct.ProductID = Product.ProductID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really appreciate if someone could give me an idea how to implement this.
Could someone please give me a link on how to create a query in
I was hoping someone could give me a hand on how I write this
Could someone give me a basic idea of how to connect an android device
Could someone give some info regarding the different character sets within visual studio's project
Could someone give me a little direction on creating crossfades/dissolves between two UIImageViews in
Without spending a long time reviewing the boost source code, could someone give me
I don't really understand Perl, so I was wondering if someone could give me
I have very little idea what I'm doing here, I've never done anything like
Could someone please give me some advice/ideas about how to deal with the situations

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.