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. The Lounge
  3. Normalization

Normalization

Scheduled Pinned Locked Moved The Lounge
question
48 Posts 21 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.
  • P PIEBALDconsult

    Eddy Vluggen wrote:

    ntroduced a table that held a varchar(31) with 0's and 1's.

    I had a colleague who used 1s and 8s -- because he couldn't get 0s to work correctly. :sigh:

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

    This is why fights start in the office.

    Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

    1 Reply Last reply
    0
    • H honey the codewitch

      I do. That's why I had to look it up. I never learned it formally. I just learned "construct a database in a way that maintains integrity and is sane enough for the application to survive for awhile"

      Real programmers use butterflies

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

      honey the codewitch wrote:

      I do. That's why I had to look it up. I never learned it formally.

      It does sound like I'm attacking. My apologies.

      honey the codewitch wrote:

      construct a database in a way that maintains integrity

      You'd laugh and go "that's soo obvious".

      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

      H 1 Reply Last reply
      0
      • L Lost User

        honey the codewitch wrote:

        I do. That's why I had to look it up. I never learned it formally.

        It does sound like I'm attacking. My apologies.

        honey the codewitch wrote:

        construct a database in a way that maintains integrity

        You'd laugh and go "that's soo obvious".

        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #26

        I didn't take it as an attack, no worries. I figured I just needed to clarify. I learned DBs in the .com boom days when it was a free for all. I attempted to impose some order on the mess. All I got for my efforts typically was put in charge of databases - something i didn't want to be in charge of. And then there was the time when I worked with a self taught developer who built out an entire ecommerce platform, front and back end, including a jquery-like (but *not jquery :~ :mad:) engine for the front end. Rather than doing JOINs in the database he was doing them in PHP on the webserver. I taught him SQL. Then I quit.

        Real programmers use butterflies

        E 1 Reply Last reply
        0
        • H honey the codewitch

          That's true, and given the amount of space to work with that we have these days, and how good databases are at doing batch data conversion and such, there really isn't a good reason to avoid redundant data if it makes things easier or more efficient. You just have to be careful not to go crazy with it, and you have to keep in mind that it can make your database more "brittle" because its more fields that need to be proofed/validated for correctness. Keeping redundant data in sync is a chore unto itself. But yes yes yes to this. Redundant data is okay, when it serves a purpose, often for performance or integration purposes it is The Right Way(TM) to do things. And if I'm wrong then I got paid a whole lot of money to be wrong, and a lot of people happy with how wrong I was. :laugh:

          Real programmers use butterflies

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

          honey the codewitch wrote:

          The Right Way(TM) to do things.

          Math.

          honey the codewitch wrote:

          And if I'm wrong then I got paid a whole lot of money to be wrong

          Yeah. Happy my surgeon isn't like that :thumbsup:

          Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          Sander RosselS 1 Reply Last reply
          0
          • L Lost User

            How many here normalize their databases?

            Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

            D Offline
            D Offline
            DerekT P
            wrote on last edited by
            #28

            Normally I do, yes. But not if I don't feel like it's going to be worth the hassle now vs benefits later.

            1 Reply Last reply
            0
            • L Lost User

              How many here normalize their databases?

              Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

              C Offline
              C Offline
              Charl
              wrote on last edited by
              #29

              How long is a piece of string - requirements would dictate NF compliance.

              1 Reply Last reply
              0
              • D dandy72

                What if my databases are _ab_normal?

                C Offline
                C Offline
                Chris Nicolatos
                wrote on last edited by
                #30

                Is your name Marty Feldman?

                1 Reply Last reply
                0
                • L Lost User

                  honey the codewitch wrote:

                  The Right Way(TM) to do things.

                  Math.

                  honey the codewitch wrote:

                  And if I'm wrong then I got paid a whole lot of money to be wrong

                  Yeah. Happy my surgeon isn't like that :thumbsup:

                  Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #31

                  Eddy Vluggen wrote:

                  Math.

                  NoMATH (for clarity, Not Only Math) :rolleyes: Actually, that math was failing with big enough datasets, which is why NoSQL was (re-)invented. So the right way to do things went from "normalize everything" to "denormalize a good bunch." We've seen the opposite happen to peanut butter.

                  Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                  E 1 Reply Last reply
                  0
                  • J Jorgen Andersson

                    When you're talking about redundant storage, are you referring to data aggregated from single points of origin or an uncontrolled mess?

                    Wrong is evil and must be defeated. - Jeff Ello

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #32

                    Why not both? :laugh: But seriously, what starts out as the first sometimes turns into the latter :^) Mostly the first though :)

                    Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                    1 Reply Last reply
                    0
                    • L Lost User

                      Sander Rossel wrote:

                      In the age of microservices every service needs to have the data it needs to do its thing.

                      Good point, those use a smaller dataset.

                      Sander Rossel wrote:

                      So I now even have multiple databases with the same data because multiple services operate on that data.

                      Operating implies you doin' more than reading that data.

                      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                      Sander RosselS Offline
                      Sander RosselS Offline
                      Sander Rossel
                      wrote on last edited by
                      #33

                      Eddy Vluggen wrote:

                      Operating implies you doin' more than reading that data.

                      It's mostly reading and transforming. Not like, changing the data and then posting it back to its origin or something like that, that would be chaos.

                      Best, Sander Azure DevOps Succinctly (free eBook) Azure Serverless Succinctly (free eBook) Migrating Apps to the Cloud with Azure arrgh.js - Bringing LINQ to JavaScript

                      1 Reply Last reply
                      0
                      • L Lost User

                        How many here normalize their databases?

                        Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                        C Offline
                        C Offline
                        Cpichols
                        wrote on last edited by
                        #34

                        I've been coding for database interaction all my adult life - since the late 80s, and I've never heard of normalization so I looked it up and I'm aghast. How can you even use a database that isn't normalized? Why would you bother? Help me out here; where are these databases and what uses do people make of them?

                        B 1 Reply Last reply
                        0
                        • C Cpichols

                          I've been coding for database interaction all my adult life - since the late 80s, and I've never heard of normalization so I looked it up and I'm aghast. How can you even use a database that isn't normalized? Why would you bother? Help me out here; where are these databases and what uses do people make of them?

                          B Offline
                          B Offline
                          BryanFazekas
                          wrote on last edited by
                          #35

                          Cpichols wrote:

                          Help me out here; where are these databases and what uses do people make of them?

                          The sad answers to your questions are "everywhere" and "a mess". Visualize a purchasing system where general customer information is free text. Further visualize trying to produce a sales report where a customer name may be spelled "ABC Trucking LLC", "ABC Trucking", "ABC Trucking Inc", and to make it really entertaining, " A B C Trucking " or " ABC Trucking" (application doesn't trim input and white space is significant). On the plus side, working with a system like this will make anyone an expert in regex ... :laugh:

                          C 1 Reply Last reply
                          0
                          • B BryanFazekas

                            Cpichols wrote:

                            Help me out here; where are these databases and what uses do people make of them?

                            The sad answers to your questions are "everywhere" and "a mess". Visualize a purchasing system where general customer information is free text. Further visualize trying to produce a sales report where a customer name may be spelled "ABC Trucking LLC", "ABC Trucking", "ABC Trucking Inc", and to make it really entertaining, " A B C Trucking " or " ABC Trucking" (application doesn't trim input and white space is significant). On the plus side, working with a system like this will make anyone an expert in regex ... :laugh:

                            C Offline
                            C Offline
                            Cpichols
                            wrote on last edited by
                            #36

                            Okay then. While I do love a good regex puzzle, I'm thinking that maybe it's best to use selection menus built from a tight db. The db I work with was brilliantly designed, but does lack the level of normalization (ooh! look at me using this word in this new-for-me way! lol) that I would prefer, but it's pretty close for all that. I'd add one more layer, iah.

                            1 Reply Last reply
                            0
                            • L Lost User

                              How many here normalize their databases?

                              Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                              M Offline
                              M Offline
                              Moo v This
                              wrote on last edited by
                              #37

                              A wise man told me once: normalize till it hurts, then denormalize until it works. My app are mostly transactional and I don't see any other way then to have denormalized data.

                              1 Reply Last reply
                              0
                              • L Lost User

                                How many here normalize their databases?

                                Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                E Offline
                                E Offline
                                ElectronProgrammer
                                wrote on last edited by
                                #38

                                I usually do not unless it is specifically requested by the project/boss because I tend to favor performance over conformance to normalization. To avoid data duplication or making a messy DB, I rely on my instinct and experience designing databases. But my DBs (for production) are usually built in layers and normalization only applies to the bottom (data) layer. On top of that are usually performance layers like "history request cache" for each client, cached queries (for full/partial queries that are required by other queries, usually per client), filters for queries (usually temporary tables with partial data), etc. And, before someone asks, yes those layers are implemented in the database (using SQL) where data is readily available and protected. And time is not wasted transferring data to some app while, in the process, creating a vulnerability in the database.

                                1 Reply Last reply
                                0
                                • H honey the codewitch

                                  I didn't take it as an attack, no worries. I figured I just needed to clarify. I learned DBs in the .com boom days when it was a free for all. I attempted to impose some order on the mess. All I got for my efforts typically was put in charge of databases - something i didn't want to be in charge of. And then there was the time when I worked with a self taught developer who built out an entire ecommerce platform, front and back end, including a jquery-like (but *not jquery :~ :mad:) engine for the front end. Rather than doing JOINs in the database he was doing them in PHP on the webserver. I taught him SQL. Then I quit.

                                  Real programmers use butterflies

                                  E Offline
                                  E Offline
                                  ElectronProgrammer
                                  wrote on last edited by
                                  #39

                                  honey the codewitch wrote:

                                  Rather than doing JOINs in the database he was doing them in PHP on the webserver

                                  I had a colleague like that once. He was transferring two 100G entries tables (+-50 columns each) to PHP to do joins using for loops. It was killing the server and taking almost a week to process. The boss only noticed when he requested a new, more powerful server (our server was brand new). Boss told me to converted it to SQL and it started taking less than an hour to do the same join ;P That colleague quit the project soon after that.

                                  D 1 Reply Last reply
                                  0
                                  • L Lost User

                                    How many here normalize their databases?

                                    Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                    B Offline
                                    B Offline
                                    Bruce Patin
                                    wrote on last edited by
                                    #40

                                    I almost always use third normal form to begin with and keep it that way unless there are performance problems.

                                    1 Reply Last reply
                                    0
                                    • L Lost User

                                      How many here normalize their databases?

                                      Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                                      M Offline
                                      M Offline
                                      MSBassSinger
                                      wrote on last edited by
                                      #41

                                      During design, I normalize to the optimum end, the denormalize where necessary for performance. I've been following that process since I started in databases back in the late 80s. Of equal importance is knowing what to index on, and how to keep indexing and PK-FK relationships from getting out of hand to where performance and supportability become a problem.

                                      1 Reply Last reply
                                      0
                                      • E ElectronProgrammer

                                        honey the codewitch wrote:

                                        Rather than doing JOINs in the database he was doing them in PHP on the webserver

                                        I had a colleague like that once. He was transferring two 100G entries tables (+-50 columns each) to PHP to do joins using for loops. It was killing the server and taking almost a week to process. The boss only noticed when he requested a new, more powerful server (our server was brand new). Boss told me to converted it to SQL and it started taking less than an hour to do the same join ;P That colleague quit the project soon after that.

                                        D Offline
                                        D Offline
                                        Daniel Pfeffer
                                        wrote on last edited by
                                        #42

                                        ElectronProgrammer wrote:

                                        That colleague quit the project soon after that.

                                        Did he fall, or was he pushed? :-\

                                        Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                        E 1 Reply Last reply
                                        0
                                        • H honey the codewitch

                                          That's true, and given the amount of space to work with that we have these days, and how good databases are at doing batch data conversion and such, there really isn't a good reason to avoid redundant data if it makes things easier or more efficient. You just have to be careful not to go crazy with it, and you have to keep in mind that it can make your database more "brittle" because its more fields that need to be proofed/validated for correctness. Keeping redundant data in sync is a chore unto itself. But yes yes yes to this. Redundant data is okay, when it serves a purpose, often for performance or integration purposes it is The Right Way(TM) to do things. And if I'm wrong then I got paid a whole lot of money to be wrong, and a lot of people happy with how wrong I was. :laugh:

                                          Real programmers use butterflies

                                          R Offline
                                          R Offline
                                          Roger House
                                          wrote on last edited by
                                          #43

                                          But don't forget what Edsger Dijstra once said: If you say the same thing twice, you will contradict yourself.

                                          H 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