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. Global Database Design for example to store Addresses

Global Database Design for example to store Addresses

Scheduled Pinned Locked Moved Database
questiondatabasedesignhelptutorial
20 Posts 6 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.
  • J Jorgen Andersson

    Eddy Vluggen wrote:

    if normalization would work that way, you'd need 7 fields for each date (Day, month, year, hours, minutes, seconds, timezone),

    I've seen that done, minus the timezone. That was a freaking moment.

    Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #11

    Jörgen Andersson wrote:

    I've seen that done, minus the timezone. That was a freaking moment.

    I imagine! I wanted a far-fetched example, so encountering something like that in the wild is a bit of a wtf-moment. Codd did not say 'eliminate every repeating group', as that would imply that we cannot even store the day number '12'. It would repeat for each month, after all. Putting the day-numbers in a separate table and linking to them using a Guid would be an option, but also a bit insane. The 'worst' modeling decision that I remember are storing everything as a varchar, including an array of bits; actually stored as a "11101010001100"-string. When I asked who wrote it (same tone as usual), my boss-for-the-moment responded saying it was an optimization :thumbsup:

    Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

    J 1 Reply Last reply
    0
    • L Lost User

      Jörgen Andersson wrote:

      I've seen that done, minus the timezone. That was a freaking moment.

      I imagine! I wanted a far-fetched example, so encountering something like that in the wild is a bit of a wtf-moment. Codd did not say 'eliminate every repeating group', as that would imply that we cannot even store the day number '12'. It would repeat for each month, after all. Putting the day-numbers in a separate table and linking to them using a Guid would be an option, but also a bit insane. The 'worst' modeling decision that I remember are storing everything as a varchar, including an array of bits; actually stored as a "11101010001100"-string. When I asked who wrote it (same tone as usual), my boss-for-the-moment responded saying it was an optimization :thumbsup:

      Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #12

      Bit array as varchar scores quite high on the list of wtf moments The really stupid part of storing time in six different fields is that they are all just different representations of the same thing (time) and you can calculate one from another. If there wasn't a date type available I'd simply store seconds in a number field, which coincidentally is what happens behind the doors in a database.

      Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

      L 1 Reply Last reply
      0
      • L LiQuick

        Dear Readers, Above question is a "small" question about something I'm at a dead end at the moment. How do I design a database to store all kind of addresses from all over the world? All countries have different address specifications. Some countries have more address fields than others, and/or of different structure. This is just a fraction of a larger problem I'm facing. I need to redesign a database that is country specific to a global design. Addresses might be the most easy thing to globalize. How do you design/model such a "global" database? Thanks in advance, Rémy Samulski

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #13

        Since this is an existing application presumably with multiple international clients presumably you will already be familar with dealing with issues about how the data will be used and how it is viewed. That will impact some of the design. I would expect that you would need to use a template which defines addressing schemes. That would be a dynamic (loaded from somewhere) part of the application to define layout for display and printing. The following is interesting read in terms of possible variations. http://www.columbia.edu/~fdc/postal/[^]

        1 Reply Last reply
        0
        • J Jorgen Andersson

          Bit array as varchar scores quite high on the list of wtf moments The really stupid part of storing time in six different fields is that they are all just different representations of the same thing (time) and you can calculate one from another. If there wasn't a date type available I'd simply store seconds in a number field, which coincidentally is what happens behind the doors in a database.

          Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #14

          Jörgen Andersson wrote:

          If there wasn't a date type available I'd simply store seconds in a number field, which coincidentally is what happens behind the doors in a database.

          The beauty of having it in seconds is that it's once again a single (atomic) fact, without any cultural formatting or localized representation :) It's hard to keep things 'simple'.

          Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

          1 Reply Last reply
          0
          • L LiQuick

            Dear Readers, Above question is a "small" question about something I'm at a dead end at the moment. How do I design a database to store all kind of addresses from all over the world? All countries have different address specifications. Some countries have more address fields than others, and/or of different structure. This is just a fraction of a larger problem I'm facing. I need to redesign a database that is country specific to a global design. Addresses might be the most easy thing to globalize. How do you design/model such a "global" database? Thanks in advance, Rémy Samulski

            L Offline
            L Offline
            LiQuick
            wrote on last edited by
            #15

            Thank you all for your time and information! As I'm a programmer in Heart and Soul I was hoping something upon a solution similar to object inheritance where I can modify a base table into a new table :), but maybe I'm way far of the planet earth. I'm considering all your answers and try to figure out a neat solution. At this moment I'm thinking about a common table (where data resides that belongs to all variants) and a "varianttype-key-value-type" (dutchAddress-roomnumber-34-int) table in which I store differences.

            L 1 Reply Last reply
            0
            • L LiQuick

              Thank you all for your time and information! As I'm a programmer in Heart and Soul I was hoping something upon a solution similar to object inheritance where I can modify a base table into a new table :), but maybe I'm way far of the planet earth. I'm considering all your answers and try to figure out a neat solution. At this moment I'm thinking about a common table (where data resides that belongs to all variants) and a "varianttype-key-value-type" (dutchAddress-roomnumber-34-int) table in which I store differences.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #16

              LiQuick wrote:

              As I'm a programmer in Heart and Soul I was hoping something upon a solution similar to object inheritance where I can modify a base table into a new table :) , but maybe I'm way far of the planet earth.

              I do not see OO as an information-modeling language. Every db will support foreigen keys, and you could copy the concept of inheritance;

              HUMAN

              Id
              Name
              Gender
              DoB

              EMPLOYEE /* let's 'inherit' a human */

              Id
              HumanFk (FK to HUMAN.Id)
              HiredOn
              HasAccessToSuperSecretFiles

              ..but in a relational world, that will make things worse. You'd get *VERY* complex queries, and most UI's would not be prepared to handle an answer that comes in various forms. If it's handled as a single entity and used as one, then store it as one.

              Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

              J 1 Reply Last reply
              0
              • L Lost User

                LiQuick wrote:

                As I'm a programmer in Heart and Soul I was hoping something upon a solution similar to object inheritance where I can modify a base table into a new table :) , but maybe I'm way far of the planet earth.

                I do not see OO as an information-modeling language. Every db will support foreigen keys, and you could copy the concept of inheritance;

                HUMAN

                Id
                Name
                Gender
                DoB

                EMPLOYEE /* let's 'inherit' a human */

                Id
                HumanFk (FK to HUMAN.Id)
                HiredOn
                HasAccessToSuperSecretFiles

                ..but in a relational world, that will make things worse. You'd get *VERY* complex queries, and most UI's would not be prepared to handle an answer that comes in various forms. If it's handled as a single entity and used as one, then store it as one.

                Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                J Offline
                J Offline
                Jorgen Andersson
                wrote on last edited by
                #17

                I'd say that it depends. It's often a balance between complex queries vs. performance. You might end up with extremely wide tables with a lot of null values where you will need many indexes instead of having one large index in the "HUMAN" table and several small optimized indexes for the "Inherited" tables. So it is a decision that can't be generalized, but rather one you need to make depending on the situation.

                Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                L 1 Reply Last reply
                0
                • J Jorgen Andersson

                  I'd say that it depends. It's often a balance between complex queries vs. performance. You might end up with extremely wide tables with a lot of null values where you will need many indexes instead of having one large index in the "HUMAN" table and several small optimized indexes for the "Inherited" tables. So it is a decision that can't be generalized, but rather one you need to make depending on the situation.

                  Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #18

                  Jörgen Andersson wrote:

                  I'd say that it depends.

                  It spells trouble, because the software that will use it will have to be prepared for a lot of scenario's. It would require "communication" and "human interaction". Two very obvious failure-points.

                  Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                  J 1 Reply Last reply
                  0
                  • L Lost User

                    Jörgen Andersson wrote:

                    I'd say that it depends.

                    It spells trouble, because the software that will use it will have to be prepared for a lot of scenario's. It would require "communication" and "human interaction". Two very obvious failure-points.

                    Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                    J Offline
                    J Offline
                    Jorgen Andersson
                    wrote on last edited by
                    #19

                    Well, I've had to clean out faulty data to many times because the software wasn't, and the communication didn't happen. So the human interaction entered data that shouldn't have been. Clean unduplicated data is the main reason to normalize, performance is a positive sideeffect. But you lose time during development, that's for sure.

                    Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                    L 1 Reply Last reply
                    0
                    • J Jorgen Andersson

                      Well, I've had to clean out faulty data to many times because the software wasn't, and the communication didn't happen. So the human interaction entered data that shouldn't have been. Clean unduplicated data is the main reason to normalize, performance is a positive sideeffect. But you lose time during development, that's for sure.

                      Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #20

                      Jörgen Andersson wrote:

                      But you lose time during development, that's for sure.

                      It's one of the more important and underestimated parts of development. It's the reason why Microsoft Access does not solve 'everything'. How much would an inconsistency in the data cost? :rolleyes:

                      Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

                      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