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

  • Home
  • SEARCH
  • 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 6663929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:33:13+00:00 2026-05-26T02:33:13+00:00

I’m having difficulty trying to form the actual question I have, so hopefully I

  • 0

I’m having difficulty trying to form the actual question I have, so hopefully I can get the point across with visual aid.

What I’m wondering is whether or not my current database design is horribly flawed, slightly inefficient, or … correct.

Q: Is there a better way for a row cell to reference a column in another table, aside from just saving a string of that column’s name?

Example:
There are two tables.

table01: has 3 columns – c_id, customer, tier (tier holds the column name of a tier in table02 )

table02: has 5 columns – i_id, item, tier1, tier2, tier3

table01 +------+----------+------+
        |'c_id'|'customer'|'tier'|
        +------+----------+------+
        |   1  | John     | tier1|
        |   2  | Lisa     | tier2|
        |   3  | Mike     | tier1|
        |   4  | Tom      | tier3|
        +------+----------+------+

table02 +------+------+-------+-------+-------+
        |'i_id'|'item'|'tier1'|'tier2'|'tier3'|
        +------+------+-------+-------+-------+
        |   1  | apple| $1.99 | $2.99 | $3.99 |
        |   2  | chalk| $2.99 | $3.99 | $4.99 |
        |   3  | pens | $3.99 | $4.99 | $5.99 |
        |   4  | shirt| $4.99 | $5.99 | $6.99 |
        +------+------+-------+-------+-------+

Result:

John    +------+-------+
        | apple| $1.99 |
        | chalk| $2.99 |
        | pens | $3.99 |
        | shirt| $4.99 |
        +------+-------+

Selecting John’s row would yield tier1, which is then used to query for table02.tier1, and grab that column’s contents. (In this discounted prices for tier1 customers). The tier1 items would then be displayed with their correct prices.

Is there a more efficient way to reference an outside table’s column name, like… in the style of foreign keys? Where if the column name changes, then that information waterfalls to other linked data cells? Is my approach correct, or should I restructure how I’m doing things?

  • 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-26T02:33:13+00:00Added an answer on May 26, 2026 at 2:33 am

    It isn’t completely clear how the c_id and i_id columns are supposed to be used, but a more conventional design would be to use a design like this:

    table01 +------+----------+------+
            |'c_id'|'customer'|'tier'|
            +------+----------+------+
            |   1  | John     |  1   |
            |   2  | Lisa     |  2   |
            |   3  | Mike     |  1   |
            |   4  | Tom      |  3   |
            +------+----------+------+
    
    table02 +------+------+-------+
            |'i_id'|'tier'|'cost' |
            +------+------+-------+
            |   1  |   1  | $1.99 |
            |   2  |   1  | $2.99 |
            |   3  |   1  | $3.99 |
            |   4  |   1  | $4.99 |
            |   1  |   2  | $2.99 |
            |   2  |   2  | $3.99 |
            |   3  |   2  | $4.99 |
            |   4  |   2  | $5.99 |
            |   1  |   3  | $3.99 |
            |   2  |   3  | $4.99 |
            |   3  |   3  | $5.99 |
            |   4  |   3  | $6.99 |
            +------+------+-------+
    

    I edited the example to better exemplify my thoughts. Which really doesn’t change your answer much. So it’d be better to consolidate the tier columns into one column and just repeat the item id (i_id) data several times? My reasoning behind breaking the tier/cost structure into columns was to cut down on redundancy. Would that approach require me to make a new table to index the tiers for foreign keys?

    I understand what you’re doing now. Somewhere along the line, you might have a ‘Sales’ table which records a c_id, and i_id, a quantity, a date and other such information (if each sale consists of one item; otherwise, you’d have an ‘Orders’ table and an ‘OrderItems’, and the c_id would be associated with the orders table and the i_id would be associated with order items, and there’d be an order number to connect the two tables).

    If you add your item desciption to the revised table02 above, you would be violating 3NF. You should have a table such as ‘Products’ with the i_id and item columns. This would give names to item numbers. The table02 (maybe ‘TieredItemCosts’) table I proposed would remain as it is; the primary key is the combination of (i_id, tier).

    • 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 jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am trying to loop through a bunch of documents I have to put
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.