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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Storing Entity states in DB

Storing Entity states in DB

Scheduled Pinned Locked Moved Database
databasetutorialquestion
4 Posts 3 Posters 18 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.
  • K Offline
    K Offline
    kabuto178
    wrote on last edited by
    #1

    I was looking for an efficient way to store "States" of entities in the DB. For example I had OrderStatus and that can be mapped to a table called Status and have the ID and the status Name be present in a join. If however I wanted to add more statuses for other Entity tables I don't want to have to create a new table for every Entity, is there a way to store all these statuses in one table? Thanks

    Richard DeemingR 1 Reply Last reply
    0
    • K kabuto178

      I was looking for an efficient way to store "States" of entities in the DB. For example I had OrderStatus and that can be mapped to a table called Status and have the ID and the status Name be present in a join. If however I wanted to add more statuses for other Entity tables I don't want to have to create a new table for every Entity, is there a way to store all these statuses in one table? Thanks

      Richard DeemingR Online
      Richard DeemingR Online
      Richard Deeming
      wrote on last edited by
      #2

      You're describing the "one true lookup table" anti-pattern. It's a bad idea. Best practices for using Simple Lookup Tables[^] Look-up Tables in SQL - Simple Talk[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      M K 2 Replies Last reply
      0
      • Richard DeemingR Richard Deeming

        You're describing the "one true lookup table" anti-pattern. It's a bad idea. Best practices for using Simple Lookup Tables[^] Look-up Tables in SQL - Simple Talk[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Richard Deeming wrote:

        It's a bad idea.

        I :laugh: :laugh: :laugh: , the last project I was asked to advise on was managed by a PM who was adamant that this was the "modern" way to go (I was accused of being an old fart who was stuck in the 90's). Started off as a 2 column table and the last I saw of it was a 5 column, 2 table structure. Luckily I walked away from anything to do with the project.

        Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

        1 Reply Last reply
        0
        • Richard DeemingR Richard Deeming

          You're describing the "one true lookup table" anti-pattern. It's a bad idea. Best practices for using Simple Lookup Tables[^] Look-up Tables in SQL - Simple Talk[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          K Offline
          K Offline
          kabuto178
          wrote on last edited by
          #4

          I take this point, I restructured my schema to just have 1 table per type for the time being, I was just trying to have less tables and then ran into this anti-pattern. Thanks for the input.

          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