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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:47:54+00:00 2026-05-20T01:47:54+00:00

I am woking on an Orable database and I am adding a couple of

  • 0

I am woking on an Orable database and I am adding a couple of lookup tables.

The general question is should the lookup table contain a code and a description and the code be the FK back to the main table, or should the lookup table contain only a description and that be the FK back to the main table.

I am arguing for the code/description pair. I feel that if I have type = Contractor and code = CN a stored proc should say where type='CN' rather than only having the type=Contractor and no code and saying this in the stored proc: where type='Contractor' Because what if I want to display: General Contractor to the user rather than Contractor. I would then have to change the stored proc. I feel that I should not have to do this. (changing a stored proc requires recompilation in dev, migration to test, retesting by the clients, and migrating a prod which requires going through a change control proccess which involves a two week waiting period; whereas modifying a record in a table does not require any of this)

My data modeler wants to use only the description. His main argument is that it would require an unnessesary join.

Which way should it be done? And if if should be done the code/description way how do i convince the data modeler?

Thanks!

type_cd    type_dsc
CN         Contractor
IN         Inspector
  • 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-20T01:47:55+00:00Added an answer on May 20, 2026 at 1:47 am

    Summarizing all of the answers, I think there are four alternatives for the lookup table:

    Alternative 1:
    • Description (primary key, a longer varchar2 column)

    Alternative 2:
    • Code (primary key, a short varchar2 column)
    • Description (not null, a longer varchar2 column)

    Alternative 3:
    • Id (a meaningless primary key, an integer value derived from a sequence)
    • Description (not null, a longer varchar2 column)

    Alternative 4:
    • Id (a meaningless primary key, an integer value derived from a sequence)
    • Code (unique key, a short varchar2 column)
    • Description (not null, a longer varchar2 column)

    The primary key column will be in the main table with a foreign key constraint on top.

    Some characteristics per alternative:

    Alternative 1:
    • No join is required when querying the main table
    • Clear meaning when doing ad-hoc queries on main table
    • Requires more storage for main table
    • Index on main table will be much bigger than in other alternatives
    • Updating a Description value means maintenance trouble and possibly application downtime.

    Alternative 2:
    • Join is required when you want to retrieve the description value
    • Join in not required if you want to filter on certain lookup values: you can use the code value for that.
    • Pretty clear meaning when doing ad-hoc queries on main table
    • Minimal additional storage requirements for main table
    • Index on main table will be small.
    • Updating a Description value is easy, however code is usually an abbreviation from the description. When updating a Description value, the code can become confusing.

    Alternative 3:
    • Join is required when you want to retrieve the description value
    • When filtering on certain lookup values, you’d have to use the Description values in your queries as the Id’s are meaningless.
    • Meaning is not clear when doing ad-hoc queries on main table
    • Minimal additional storage requirements for main table
    • Index on main table will be small.
    • Updating a Description value is easy and doesn’t cause confusion as with Code values

    Alternative 4:
    • Join is required when you want to retrieve the description value
    • Join is required when filtering on certain lookup values, you would use the Code value in the lookup table.
    • Meaning is not clear when doing ad-hoc queries on main table
    • Minimal additional storage requirements for main table
    • Index on main table will be small
    • Updating a Description value is easy and you can also very easily update the Code value as well to make it resemble the Description value. You may have to revisit some of your code when doing this, though.

    Personal opinion:

    I would look at how I plan to use the main table and the lookup table. Which queries will be important and have to run efficiently? Will the values ever change?

    My personal choice would be alternative 2 or 4. I’d use alternative 2 if I was absolutely sure that the code value can never change. And this is rare. Country codes change, social security numbers change. Currency codes change, etcetera. So, most of the time, I’d choose alternative 4. I’d not be so concerned for an extra join, especially because the lookup table is a small table.

    But: choose an alternative that suits your requirements.

    Please feel free to edit the text when you know some more characteristics of an alternative.

    Regards,
    Rob.

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

Sidebar

Related Questions

I'm working on a project with a rather large Oracle database (although my question
We are working with an oracle database in which the person that set it
I am working with a oracle database and Jython. I can get data pulled
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
When working with tables in Oracle, how do you know when you are setting
I have SQL query, which is working nice on Oracle and MSSQL. Now I'm
Working with dates in ruby and rails on windows, I'm having problems with pre-epoch
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a project at the moment and we have to implement soft deletion
Working on a somewhat complex page for configuring customers at work. The setup is

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.