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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:11:23+00:00 2026-06-05T06:11:23+00:00

I’m having a hard time figuring out the best way to organize a database.

  • 0

I’m having a hard time figuring out the best way to organize a database. There are three tables relevant to the problem at hand: user, good, and transaction. In an ideal scenario, each transaction would comprise an identifying relationship with a single user and a single good. But what is the best way to handle multiple goods? (In my case, a user might purchase hundreds of different goods in a single transaction.) Should I simply create a comma-separated list and stick it in a TEXT field? This seems to go against conventional wisdom for database design…

  • 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-05T06:11:24+00:00Added an answer on June 5, 2026 at 6:11 am

    You need these tables and columns in addition to ones you’ve listed:
    TRANSACTION_GOOD_MAPPING:
    Trnsctn_good_id (pk), transaction_id (fk to transaction table), good_id (fk to good table)

    USER_TRANSACTION_MAPPING:
    user_trnsctn_id, user_id (fk to user table), tramsaction_id (fk into transaction table)

    The above will allow you to have users with many transactions and transactions with many goods.

    Here is a sample query to get a list of goods for a given transaction of a given user:

    select good_id, good_name, good_desc
    From user u, good g, transaction t,
    Transaction_good_mapping tgm, user_tramsaction_mapping utm
    Where u.user_id=utm.user_id
    And utm.transaction_id=tgm.transaction_id
    And g.good_id=tgm.good_id
    And u.user_id=’someuserid’
    And tramsaction_id=some_tramsaction_id

    Note: for the last two lines in the above query make sure you use variable substitution in the query to avoid SQL injection.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a reasonable size flat file database of text documents mostly saved in
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.