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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:51:03+00:00 2026-05-26T05:51:03+00:00

Question. I have an item that can have an individual values or a ‘package’

  • 0

Question. I have an item that can have an individual values or a ‘package’ values.

e.g.:

Item

Table Car
id INT
package_id INT
alloys BOOLEAN
aircon BOLLEAN
airbags TINYINT
transmission ENUM('auto','manual')

And packages:

Table Package
package_id INT
alloys BOOLEAN
aircon BOLLEAN
airbags TINYINT
transmission ENUM('auto','manual')

Customers can create any package (there is more fields than in this example, say 15) and then apply it to any car. Its a one to many relation (one package can be applied to many cars). However they dont have to use packages. They can specify all elements individually. Now my question is what is better to do?

  1. Like its done above and if package_id in Car is NULL then use values from Car
  2. Store every set of changes in Package even if it’s not the package per se but a custom work (and add some is_package bool to determinie if it should show in packages list).
  3. Create separate table for storing those custom, one time options?
  4. Any other idea?

Thanks in advance!

  • 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-26T05:51:03+00:00Added an answer on May 26, 2026 at 5:51 am

    if I understand correctly, you describe a simple 1:n relationship. I’d prefer 2nd option and setting Car.package_id as NOT NULL :

    Table Car
    ---------
    id INT PRIMARY KEY
    package_id INT NOT NULL
    FOREIGN KEY (package_id)
      REFERENCES Package (package_id)    
    
    Table Package
    -------------
    package_id INT PRIMARY KEY
    alloys BOOLEAN
    aircon BOLLEAN
    airbags TINYINT
    transmission ENUM('auto','manual')
    

    You will still be able to find – with a simple query – which packages are “custom” (used only in one car) or used by many cars.

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

Sidebar

Related Questions

I've have a table view that consist of item list that depends on the
Imagine I have a table called item that has a column called price. In
I have just created an algorithm for item based collaborative filtering, that can take
So I have, what would seem like a common question that I can't seem
Question: I have a question that is apparently not answered by this already-asked Bash
Question We have a large number of xml configuration files that we want merged
I have question regarding the SQLAlchemy. How can I add into my mapped class
I have a question: I have two MSSQL tables, items and states, that are
I have a question that is more in the realm of design, than implementation.
I have a set of items that can be dragged / dropped using Dojo

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.