Simple Yes/No Question Regarding Inferences

I was looking up information regarding SQL when I came across this on a website (http://www.dbpd.com/vault/9801xtra.htm):

19. Redundancy is good.
Provide as much information as possible in the WHERE clause. For example, if the WHERE clause is WHERE COL1 = COL2 and COL1 = 10, the optimizer will infer that COL2 =10. But if the WHERE clause is WHERE COL1 = COL2 and COL2 = COL3, then optimizer will not infer that COL1 = COL3.

Is this true for SQL Server

Thanks

- Jason "DiZASTiX"



Answer this question

Simple Yes/No Question Regarding Inferences

  • Kal100

    In Re Adamus:

    All birds have wings.
    All flies have wings.

    =================================

    Therefore all birds are flies. <--Logically true but disturbing. The author is suggesting the contrary.

    The author's assessment is wrong because it is logically false

    This isn't true for any server, application, or logic for that matter.

    Adamus

    -----------------------------------------------------------------------

    Your conclusion is heavily flawed.  The logic elicited by the author may be summarized like so:

    Let A, B, and C be entities
    A = B & B = C
    A=C
    (by transitive property)

    Your statement correctly stated is:

    For my ease, I'll will redefine some symbols:
    - V shall be "for all" (instead of the upsidedown A)
    - E shall be "there exists" (instead of the backwards E)
    - c shall be strictly worded as "is a proper subset of" as opposed to "is a subset of"
    - shall be "is an element of"
    - ~ shall be used in place of slashes through symbols (i.e., complimenting the meaning of the symbol)

    1. Definition
    A = {birds}
    B = {flies}

    2. Equality
    VA, VB : A = B ( VC : C A    C B )

    3. Premise
    D c C

    4.
    ED  st  D ~ { A ∩ B }

    5. Conclusion
    A ~= B

    Example.  A={1,2,3}, B={1,2,3,4}... D={4} is one possible choice of D c C, but A ∩ B = {1,2,3}; D c C but VC, C not always A and  B... namely... In words, A is the set defined by 1,2,3; B is the set defined by 1,2,3,4.  D is a proper subset of C.  One valid choice of D is 4.  However, there exists a D that is not an element of the set defined by the intersection of A and B.  Concordantly (with the violation of D as a proper subset of C, and C being an element of B but not an element of A), it follows that A is not equal to B.

     

    - Jason "DiZASTiX"


  • ender&amp;#35;

    DiZASTiX wrote:

    In Re Adamus:

    All birds have wings.
    All flies have wings.

    =================================

    Therefore all birds are flies. <--Logically true but disturbing. The author is suggesting the contrary.

    The author's assessment is wrong because it is logically false

    This isn't true for any server, application, or logic for that matter.

    Adamus

    -----------------------------------------------------------------------

    Your conclusion is heavily flawed. The logic elicited by the author may be summarized like so:

    Let A, B, and C be entities
    A = B & B = C
    A=C
    (by transitive property)

    Your statement correctly stated is:

    For my ease, I'll will redefine some symbols:
    - V shall be "for all" (instead of the upsidedown A)
    - E shall be "there exists" (instead of the backwards E)
    - c shall be strictly worded as "is a proper subset of" as opposed to "is a subset of"
    - shall be "is an element of"
    - ~ shall be used in place of slashes through symbols (i.e., complimenting the meaning of the symbol)

    1. Definition
    A = {birds}
    B = {flies}

    2. Equality
    VA, VB : A = B ( VC : C A C B )

    3. Premise
    D c C

    4.
    ED st D ~ { A ∩ B }

    5. Conclusion
    A ~= B

    Example. A={1,2,3}, B={1,2,3,4}... D={4} is one possible choice of D c C, but A ∩ B = {1,2,3}; D c C but VC, C not always A and B... namely... In words, A is the set defined by 1,2,3; B is the set defined by 1,2,3,4. D is a proper subset of C. One valid choice of D is 4. However, there exists a D that is not an element of the set defined by the intersection of A and B. Concordantly (with the violation of D as a proper subset of C, and C being an element of B but not an element of A), it follows that A is not equal to B.

    - Jason "DiZASTiX"

    Oh you were looking for an argument not an answer. There are flamer forums for that. Please post there and use a basic truth table for the logic.

  • Paul Gerald

     Adamus Turner wrote:
     DiZASTiX wrote:

    In Re Adamus:

    All birds have wings.
    All flies have wings.

    =================================

    Therefore all birds are flies. <--Logically true but disturbing. The author is suggesting the contrary.

    The author's assessment is wrong because it is logically false

    This isn't true for any server, application, or logic for that matter.

    Adamus

    -----------------------------------------------------------------------

    Your conclusion is heavily flawed.  The logic elicited by the author may be summarized like so:

    Let A, B, and C be entities
    A = B & B = C
    A=C
    (by transitive property)

    Your statement correctly stated is:

    For my ease, I'll will redefine some symbols:
    - V shall be "for all" (instead of the upsidedown A)
    - E shall be "there exists" (instead of the backwards E)
    - c shall be strictly worded as "is a proper subset of" as opposed to "is a subset of"
    - shall be "is an element of"
    - ~ shall be used in place of slashes through symbols (i.e., complimenting the meaning of the symbol)

    1. Definition
    A = {birds}
    B = {flies}

    2. Equality
    VA, VB : A = B ( VC : C A    C B )

    3. Premise
    D c C

    4.
    ED  st  D ~ { A n B }

    5. Conclusion
    A ~= B

    Example.  A={1,2,3}, B={1,2,3,4}... D={4} is one possible choice of D c C, but A n B = {1,2,3}; D c C but VC, C not always A and  B... namely... In words, A is the set defined by 1,2,3; B is the set defined by 1,2,3,4.  D is a proper subset of C.  One valid choice of D is 4.  However, there exists a D that is not an element of the set defined by the intersection of A and B.  Concordantly (with the violation of D as a proper subset of C, and C being an element of B but not an element of A), it follows that A is not equal to B.

     

    - Jason "DiZASTiX"

    Oh you were looking for an argument not an answer. There are flamer forums for that. Please post there and use a basic truth table for the logic.

    Why should I use a truth table   What if it is the case that I don't know how to use a truth table   You must understand that I am not a CS guy.  I am simply applying my knowledge of mathematics and philosophy.

     Umachandar Jayachandran - MS wrote:
    It is not true for SQL Server since 70 version. Optimizer can infer transitivity of predicates based on your WHERE clause. However, it doesn't really hurt to specify the redundant conditions. It does help in reading the query easily especially for someone who is not familiar with the schema and don't know all the relationships.

    Thank you that is the answer I am looking for.


  • Edijs

    Actually, it was true for versions of SQL Server before 70. So the author is correct to some extent and not all database implementations can infer predicate transitivity. Query optimization is a costly process and some of the rule-based ones for example simply use the information in the query directly. And depending on how you write your query predicate transitivity can be inferred or not. So you cannot generalize your statement.

  • cmendozas

    It is not true for SQL Server since 70 version. Optimizer can infer transitivity of predicates based on your WHERE clause. However, it doesn't really hurt to specify the redundant conditions. It does help in reading the query easily especially for someone who is not familiar with the schema and don't know all the relationships.

  • emmmmmmer

    All birds have wings.

    All flies have wings.

    =================================

    Therefore all birds are flies. <--Logically true but disturbing. The author is suggesting the contrary.

    The author's assessment is wrong because it is logically false

    This isn't true for any server, application, or logic for that matter.

    Adamus



  • Simple Yes/No Question Regarding Inferences