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. A question about design Relational Model

A question about design Relational Model

Scheduled Pinned Locked Moved Database
helpdatabasedesigntutorialquestion
24 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.
  • K Klaus Werner Konrad

    Eddy Vluggen wrote:

    If the original data can be reconstructed from that resulting data, you'll be able to reverse that process.

    Bullshit - you cannot reverse the result of a calculation - nevertheless you can have a calculation of other colums ...

    Eddy Vluggen wrote:

    Not according to the theories of Codd.

    You will at least violate 2NF ...

    Eddy Vluggen wrote:

    1. Allowed by whom? If it's my responsibility, then I'll model as I think is correct - if it were something that could simply be "decided" once and for all, they'd put it in a servicepack and be done with it.

    Ok, it's YOUR decision, but HERE we're talking about NORMALIZED databases !!!

    Eddy Vluggen wrote:

    1. Has nothing to do with speed.

    Let's assume it's somethig like SUM( SQRT( PI * DRM) ) Depending on your indices and the sort of query this can be a REALLY time consuming operation, and in such a case a denormalization would be valid (=accepted), but colA +colB isn't such a case, 'cause it's cheap to calc.

    Eddy Vluggen wrote:

    1. Whether a column is calculated doesn't say anything about the fact "when" it's going to be calculated.

    See my response above

    Eddy Vluggen wrote:

    That would be modeled as a calculated column in the conceptual model.

    The relational model from Codd don't know 'calculated column', as this is AGAINST the model by itself ...

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

    Klaus-Werner Konrad wrote:

    bullsh*t - you cannot reverse the result of a calculation - nevertheless you can have a calculation of other colums ...

    From mp/h to m/s and back.

    Klaus-Werner Konrad wrote:

    You will at least violate 2NF ...

    Second normal form is about finding the complete key. It doesn't make statements on atomicity of facts.

    Klaus-Werner Konrad wrote:

    Ok, it's YOUR decision, but HERE we're talking about NORMALIZED databases !!!

    I know. Stop shouting.

    Klaus-Werner Konrad wrote:

    Let's assume it's somethig like SUM( SQRT( PI * DRM) )
    Depending on your indices and the sort of query this can be a REALLY time consuming operation, and in such a case a denormalization would be valid (=accepted), but colA +colB isn't such a case, 'cause it's cheap to calc.

    Let me repeat that; Normalization has nothing to do with speed. It's about creating a theoretical correct model. A wise man might decide to optimize by denormalizing when implementing the physical layer.

    Klaus-Werner Konrad wrote:

    The relational model from Codd don't know 'calculated column', as this is AGAINST the model by itself ...

    Name the rule that it breaks.

    I are Troll :suss:

    K S 2 Replies Last reply
    0
    • L Lost User

      Klaus-Werner Konrad wrote:

      bullsh*t - you cannot reverse the result of a calculation - nevertheless you can have a calculation of other colums ...

      From mp/h to m/s and back.

      Klaus-Werner Konrad wrote:

      You will at least violate 2NF ...

      Second normal form is about finding the complete key. It doesn't make statements on atomicity of facts.

      Klaus-Werner Konrad wrote:

      Ok, it's YOUR decision, but HERE we're talking about NORMALIZED databases !!!

      I know. Stop shouting.

      Klaus-Werner Konrad wrote:

      Let's assume it's somethig like SUM( SQRT( PI * DRM) )
      Depending on your indices and the sort of query this can be a REALLY time consuming operation, and in such a case a denormalization would be valid (=accepted), but colA +colB isn't such a case, 'cause it's cheap to calc.

      Let me repeat that; Normalization has nothing to do with speed. It's about creating a theoretical correct model. A wise man might decide to optimize by denormalizing when implementing the physical layer.

      Klaus-Werner Konrad wrote:

      The relational model from Codd don't know 'calculated column', as this is AGAINST the model by itself ...

      Name the rule that it breaks.

      I are Troll :suss:

      K Offline
      K Offline
      Klaus Werner Konrad
      wrote on last edited by
      #16

      Eddy Vluggen wrote:

      Klaus-Werner Konrad wrote:

      bullsh*t - you cannot reverse the result of a calculation - nevertheless you can have a calculation of other colums ...

      From mp/h to m/s and back.

      This is not a calculation - it's a conversion, and every conversion can be reverted !

      Eddy Vluggen wrote:

      Klaus-Werner Konrad wrote:

      You will at least violate 2NF ...

      Second normal form is about finding the complete key. It doesn't make statements on atomicity of facts.

      Wikipedia: "No non-prime attribute in the table is functionally dependent on a proper subset of a candidate key"

      Eddy Vluggen wrote:

      Klaus-Werner Konrad wrote:

      Ok, it's YOUR decision, but HERE we're talking about NORMALIZED databases !!!

      I know. Stop shouting.

      Sorry - I'm just old fashioned (You've ever connected via a 300baud accoustic modem ? No Internet, no HTML, no chance to enhance your msg than put *stars* or _underlines_ around it ?) And - *just* in _these_ days I prefer plain text messages, 'cause evertything else can carry some unwanted payload ...

      Eddy Vluggen wrote:

      Klaus-Werner Konrad wrote:

      Let's assume it's somethig like SUM( SQRT( PI * DRM) )
      Depending on your indices and the sort of query this can be a REALLY time consuming operation, and in such a case a denormalization would be valid (=accepted), but colA +colB isn't such a case, 'cause it's cheap to calc.

      Let me repeat that; Normalization has nothing to do with speed. It's about creating a theoretical correct model.
      A wise man might decide to optimize by denormalizing when implementing the physical layer.

      So you repeat my statement (see underlined portions of my original post) ...

      Eddy Vluggen wrote:

      Klaus-Werner Konrad wrote:

      The relational model from Codd don't know 'calculated column', as this is AGAINST the model by itself ...

      Name the rule that it breaks.

      As said before: NF2

      L 1 Reply Last reply
      0
      • L Lost User

        What database are you using? If you are using SQL Server, you can create computed columns. I believe other databases have similar features too. Better yet, create a View with the calculated column.

        K Offline
        K Offline
        Klaus Werner Konrad
        wrote on last edited by
        #17

        You are right, a view (evtl. companyied (is this right ?) with functions) is the right way on the DB side, but that was not the original question - that was about creating additional coloums in the BASE table that hold the calculated results

        1 Reply Last reply
        0
        • K Klaus Werner Konrad

          Eddy Vluggen wrote:

          Klaus-Werner Konrad wrote:

          bullsh*t - you cannot reverse the result of a calculation - nevertheless you can have a calculation of other colums ...

          From mp/h to m/s and back.

          This is not a calculation - it's a conversion, and every conversion can be reverted !

          Eddy Vluggen wrote:

          Klaus-Werner Konrad wrote:

          You will at least violate 2NF ...

          Second normal form is about finding the complete key. It doesn't make statements on atomicity of facts.

          Wikipedia: "No non-prime attribute in the table is functionally dependent on a proper subset of a candidate key"

          Eddy Vluggen wrote:

          Klaus-Werner Konrad wrote:

          Ok, it's YOUR decision, but HERE we're talking about NORMALIZED databases !!!

          I know. Stop shouting.

          Sorry - I'm just old fashioned (You've ever connected via a 300baud accoustic modem ? No Internet, no HTML, no chance to enhance your msg than put *stars* or _underlines_ around it ?) And - *just* in _these_ days I prefer plain text messages, 'cause evertything else can carry some unwanted payload ...

          Eddy Vluggen wrote:

          Klaus-Werner Konrad wrote:

          Let's assume it's somethig like SUM( SQRT( PI * DRM) )
          Depending on your indices and the sort of query this can be a REALLY time consuming operation, and in such a case a denormalization would be valid (=accepted), but colA +colB isn't such a case, 'cause it's cheap to calc.

          Let me repeat that; Normalization has nothing to do with speed. It's about creating a theoretical correct model.
          A wise man might decide to optimize by denormalizing when implementing the physical layer.

          So you repeat my statement (see underlined portions of my original post) ...

          Eddy Vluggen wrote:

          Klaus-Werner Konrad wrote:

          The relational model from Codd don't know 'calculated column', as this is AGAINST the model by itself ...

          Name the rule that it breaks.

          As said before: NF2

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

          Klaus-Werner Konrad wrote:

          This is not a calculation - it's a conversion, and every conversion can be reverted !

          A conversion is a specific type of calculation. A multiplication with a constant is another example; not a conversion, but still reversible.

          Klaus-Werner Konrad wrote:

          So you repeat my statement (see underlined portions of my original post) ...

          No, I did not repeat you, but you're correct to state that in such a case it would be defend able to denormalize.

          Klaus-Werner Konrad wrote:

          As said before: NF2

          I was looking for argumentation. As said before, it doesn't. All non-atomic facts have been removed before it can be called 1NF. The 2NF rule states that the fact that's described (possibly the result of a calculation) should be identifyable with the same key that you use to identify the tupel. Take a "Departments" table - it may very well have a fact that states how many employees it currently harbors. The 2NF rule states that the "count" fact belong to the object that we use to identify a single tupel in departments-table. It's the key that gives the fact a context. The fact "32" as a "count" would lose context (and no longer be information) if we cannot link it to a specific department. It's not relevant for the conceptual model how that number gets there - it may be a small operation, it may be a long operation. When describing the domain-model, we do include the information that it's information that can be deduced from other data - saves the person who has to implement the physical layer a bit time.

          I are Troll :suss:

          1 Reply Last reply
          0
          • L Lost User

            Keith Barrow wrote:

            The calculated column relies on other data, it isn't atomic

            It relies on other data, that's true, but you cannot decompose the value. It's a new atomic fact, not a composition of other facts. Yes, you can deduce it from other data, but in this case only in one direction (as opposed to a birthdate and an age)

            Keith Barrow wrote:

            The classic examples use concatenation, but it is realy a relies upon relationship.

            Any concatenation of characters would fall under this category. The question is whether the fact that's being described is atomic, not the data. Whether or not a column is computed (and whether or not the value is stored or recomputed), doesn't matter much for the relational model; that's merely an implementation-detail.

            I are Troll :suss:

            S Offline
            S Offline
            SilimSayo
            wrote on last edited by
            #19

            If the original values change then, there will be data inconsistency (i.e. the calculated columns will not be correct).

            L 1 Reply Last reply
            0
            • L Lost User

              Klaus-Werner Konrad wrote:

              bullsh*t - you cannot reverse the result of a calculation - nevertheless you can have a calculation of other colums ...

              From mp/h to m/s and back.

              Klaus-Werner Konrad wrote:

              You will at least violate 2NF ...

              Second normal form is about finding the complete key. It doesn't make statements on atomicity of facts.

              Klaus-Werner Konrad wrote:

              Ok, it's YOUR decision, but HERE we're talking about NORMALIZED databases !!!

              I know. Stop shouting.

              Klaus-Werner Konrad wrote:

              Let's assume it's somethig like SUM( SQRT( PI * DRM) )
              Depending on your indices and the sort of query this can be a REALLY time consuming operation, and in such a case a denormalization would be valid (=accepted), but colA +colB isn't such a case, 'cause it's cheap to calc.

              Let me repeat that; Normalization has nothing to do with speed. It's about creating a theoretical correct model. A wise man might decide to optimize by denormalizing when implementing the physical layer.

              Klaus-Werner Konrad wrote:

              The relational model from Codd don't know 'calculated column', as this is AGAINST the model by itself ...

              Name the rule that it breaks.

              I are Troll :suss:

              S Offline
              S Offline
              SilimSayo
              wrote on last edited by
              #20

              The relational model was developed to deal with issue of data inconsistency and data redundancy. Calculated columns are redundant and also they can cause data inconsistency problems; if the values used in the calculation are changed, the calculate column will be inconsistent/incorrect.

              1 Reply Last reply
              0
              • S SilimSayo

                If the original values change then, there will be data inconsistency (i.e. the calculated columns will not be correct).

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

                SilimSayo wrote:

                If the original values change then, there will be data inconsistency (i.e. the calculated columns will not be correct).

                Incorrect isn't the same as inconsistent, and up-to-date is not the same as incorrect.

                I are Troll :suss:

                S 1 Reply Last reply
                0
                • L Lost User

                  SilimSayo wrote:

                  If the original values change then, there will be data inconsistency (i.e. the calculated columns will not be correct).

                  Incorrect isn't the same as inconsistent, and up-to-date is not the same as incorrect.

                  I are Troll :suss:

                  S Offline
                  S Offline
                  SilimSayo
                  wrote on last edited by
                  #22

                  Semantics!!!!

                  L 1 Reply Last reply
                  0
                  • S SilimSayo

                    Semantics!!!!

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

                    SilimSayo wrote:

                    Semantics!!!!

                    The exact definition is important, and not just a semantical detail. And no, I do not appreciate hit&run comments, as it's a lousy way of communicating.

                    I are Troll :suss:

                    S 1 Reply Last reply
                    0
                    • L Lost User

                      SilimSayo wrote:

                      Semantics!!!!

                      The exact definition is important, and not just a semantical detail. And no, I do not appreciate hit&run comments, as it's a lousy way of communicating.

                      I are Troll :suss:

                      S Offline
                      S Offline
                      SilimSayo
                      wrote on last edited by
                      #24

                      Suppose I have a calculated field for age computed from dob and the current date. If this field is not updated and you query someone's age, it will return incorrect results. For example, if the query returns someone's [current] age as 64 when it should have been 65, the result would be incorrect.

                      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