Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Simple Table Design Question

Simple Table Design Question

Scheduled Pinned Locked Moved Database
questiondesigntutorialannouncement
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dataminers
    wrote on last edited by
    #1

    Dictionary Table; Records in only 2 lines (for example, a table of sex: male, female) or as much as 40-50 lines and changing of future data in the table Insert / Update / Delete operations possibility of very low.

    Combining these tables in a single table, Does it make sense?

    For Example;

    TBL_Sex
    1 Male
    2 Female

    TBL_WorkType
    1 Full-Time
    2 Part-Time

    TBL_BloodType
    1 A Rh(+)
    2 B Rh(+)
    3 AB Rh(+)
    4 0 Rh(-)
    5 A Rh(-)
    6 B Rh(-)
    7 AB Rh(-)
    8 0 Rh(-)

    Instead of following table;

    TBL_DICTIONARY

    ID GROUP VALUE


    1 Sex Erkek
    2 Sex Kadın
    3 WorkType Yarım Gün
    4 WorkType Tam Gün
    5 BloodType A Rh(+)
    6 BloodType B Rh(+)
    7 BloodType AB Rh(+)
    8 BloodType 0 Rh(-)
    9 BloodType A Rh(-)
    10 BloodType B Rh(-)
    11 BloodType AB Rh(-)
    12 BloodType 0 Rh(-)

    L D 2 Replies Last reply
    0
    • D dataminers

      Dictionary Table; Records in only 2 lines (for example, a table of sex: male, female) or as much as 40-50 lines and changing of future data in the table Insert / Update / Delete operations possibility of very low.

      Combining these tables in a single table, Does it make sense?

      For Example;

      TBL_Sex
      1 Male
      2 Female

      TBL_WorkType
      1 Full-Time
      2 Part-Time

      TBL_BloodType
      1 A Rh(+)
      2 B Rh(+)
      3 AB Rh(+)
      4 0 Rh(-)
      5 A Rh(-)
      6 B Rh(-)
      7 AB Rh(-)
      8 0 Rh(-)

      Instead of following table;

      TBL_DICTIONARY

      ID GROUP VALUE


      1 Sex Erkek
      2 Sex Kadın
      3 WorkType Yarım Gün
      4 WorkType Tam Gün
      5 BloodType A Rh(+)
      6 BloodType B Rh(+)
      7 BloodType AB Rh(+)
      8 BloodType 0 Rh(-)
      9 BloodType A Rh(-)
      10 BloodType B Rh(-)
      11 BloodType AB Rh(-)
      12 BloodType 0 Rh(-)

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      I'd use separate tables for such "enums". :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
      [The QA section does it automatically now, I hope we soon get it on regular forums as well]


      D 1 Reply Last reply
      0
      • L Luc Pattyn

        I'd use separate tables for such "enums". :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
        [The QA section does it automatically now, I hope we soon get it on regular forums as well]


        D Offline
        D Offline
        dataminers
        wrote on last edited by
        #3

        So; Do you use TBL_Sex, TBL_WorkType, TBL_BloodType or use TBL_DICTIONARY ?

        A 1 Reply Last reply
        0
        • D dataminers

          So; Do you use TBL_Sex, TBL_WorkType, TBL_BloodType or use TBL_DICTIONARY ?

          A Offline
          A Offline
          Andy_L_J
          wrote on last edited by
          #4

          dataminers wrote:

          use TBL_Sex, TBL_WorkType, TBL_BloodType

          :thumbsup:

          I don't speak Idiot - please talk slowly and clearly 'This space for rent' Driven to the arms of Heineken by the wife

          1 Reply Last reply
          0
          • D dataminers

            Dictionary Table; Records in only 2 lines (for example, a table of sex: male, female) or as much as 40-50 lines and changing of future data in the table Insert / Update / Delete operations possibility of very low.

            Combining these tables in a single table, Does it make sense?

            For Example;

            TBL_Sex
            1 Male
            2 Female

            TBL_WorkType
            1 Full-Time
            2 Part-Time

            TBL_BloodType
            1 A Rh(+)
            2 B Rh(+)
            3 AB Rh(+)
            4 0 Rh(-)
            5 A Rh(-)
            6 B Rh(-)
            7 AB Rh(-)
            8 0 Rh(-)

            Instead of following table;

            TBL_DICTIONARY

            ID GROUP VALUE


            1 Sex Erkek
            2 Sex Kadın
            3 WorkType Yarım Gün
            4 WorkType Tam Gün
            5 BloodType A Rh(+)
            6 BloodType B Rh(+)
            7 BloodType AB Rh(+)
            8 BloodType 0 Rh(-)
            9 BloodType A Rh(-)
            10 BloodType B Rh(-)
            11 BloodType AB Rh(-)
            12 BloodType 0 Rh(-)

            D Offline
            D Offline
            David Mujica
            wrote on last edited by
            #5

            Using separate tables also allows you to create foreign key references so that you can guarantee that the data in your tables remain consistent. For example: Tbl_Patient ID: Sex: Work_type: Blood_type: additional fields, blah, blah ... On this new table,Tbl_Patient, you would create foreign key references to tbl_sex, tbl_worktype, tbl_bloodtype, so that only valid values can be stored in those columns. Good luck on your project and keep asking questions ... it's the only way to learn. :cool:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups