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

The Archive Base Latest Questions

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

I am building a database system and having trouble with the design of one

  • 0

I am building a database system and having trouble with the design of one of my tables.

In this system there is a users table, an object table, an item table and cost table.

A unique record in the cost table is determine by the user, object, item and year. However, there can be multiple records that have the same year if the item is different.

The hierarchy goes user->object->item->year, multiple unique years per item, multiple unique items per object, multiple unique objects per user, multiple unique users.

What would be the best way to design the cost table?

I am thinking of including the userid, objectid and itemid as foreign keys and then using a composite key consisting of userid, objecid, itemid and costyear. I have heard that composite keys are bad design, but I am unsure how to structure this to get away from using a composite key. As you can tell my database building skills are a bit rusty.

Thanks!

P.S. If it matters, this is an interbase db.

  • 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-12T17:09:21+00:00Added an answer on May 12, 2026 at 5:09 pm

    To avoid the composite key, you just define a surrogate key. This holds an artificial value, for instance an auto counter.

    You still can (and should) define a unique constraint on these columns.

    Btw: its not only recommended not to use composite keys, it’s also recommendable to use surrogate keys. In all your tables.

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

Sidebar

Related Questions

I'm building a database for making hotel reservations. One table called reservations holds the
What would be a scalable file upload/download system/database? I'm building a website where users
Scenario I am building a database that contains a series of different tables. These
I'm working on building a database to manage project assignments, and the one part
For the purpose of building a database system I am using a simple builder
I'm building a database table representing a 'note' that has a parent-child relationship in
I'm building an auction-like system in Rails 3 (using PostgreSQL as the database). Imagine
I will be building a system where a particular object will originate from a
I'm building a database in django but I've run into a bit of an
I'm building a claims database with the above schema so far. Three three-part key

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.