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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:30:48+00:00 2026-06-02T05:30:48+00:00

I have two tables: table1: id(int) | stuff(text) ————————- 1 | foobarfoobarfoo 2 |

  • 0

I have two tables:

table1:

id(int) | stuff(text)
-------------------------
1       | foobarfoobarfoo
2       | blahfooblah
3       | foo

table2:

id(int) | otherstuff(text)
--------------------------
1       | foo
2       | bar
3       | blah

A row in table1 can have more than one of foo, bar etc. And, each row in table2 can appear in more than one row of table1.

Which is a better way of keeping this straight. Should I create a third table like this:

table3:

id_from2(int) | id_from1(int)
-----------------------------
1             | 1
1             | 2
1             | 3
2             | 1
3             | 2

Or, should I have an column of type array added to table1 and table2 to keep track of the same information?

  • 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-02T05:30:50+00:00Added an answer on June 2, 2026 at 5:30 am

    Yes, using junction tables is the correct way of implementing many-to-many relations in RDBMS.

    You can add more attributes to your junction table (i.e. table3) if necessary. For example, if the relations are ordered, you can add a third field that specifies an ordering of the (table1, table2) combinations. Here is a link to an answer on Stack Overflow that gives a nice detailed example of a many-to-many table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have two tables tblA ( tableAID INT IDENTITY(1,1), foo VARCHAR(100)) tblB
I have two tables CREATE TABLE table1 (id int primary key auto_increment,....); CREATE TABLE
I have two tables: CREATE TABLE Table1 ( ID VARCHAR(15), Value INT ); INSERT
If I have two tables such as this: CREATE TABLE #table1 (id INT, name
I have the following two tables: CREATE TABLE `table1` ( `ID` int(11) NOT NULL
I have two tables: table1 table2 column id column id column value 1 1
I have two tables which looks something like this Table Queue int ID; string
I have two tables. table_x: id INT(11) tag INT(11) table_tags: id INT(11) name VARCHAR(255)
So I have two tables structured like so: CREATE TABLE #nodes(node int NOT NULL);
I have those two tables: client: id (int) #PK name (varchar) client_category: id (int)

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.