Is order important?

  • Comments posted to this topic are about the item Is order important?

  • This was removed by the editor as SPAM

  • I know it's not really the point of your question but

    select count(*) from x where n % 6 = 0 and not n % 5=0

    😀

  • Interesting question and just so happened to have read about this last week!

    That's why I always use parenthesis

    They also make queries easier to read

    Especially with +, -, *, /, ... equations

    - Damian

  • Thanks, Mike!

    BTW, why there are snippets a and c when they are not mentioned in possible replies? Just curious.

  • Thanks Mike! A great way to reinforce the concepts 🙂

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • I figured B, though I was struggling with D and was glad that the options were this or not this rather than figuring out the math on D 🙂

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

  • DamianC (11/4/2016)


    Interesting question and just so happened to have read about this last week!

    That's why I always use parenthesis

    They also make queries easier to read

    Especially with +, -, *, /, ... equations

    I was taught to use parenthesis not only for the compiler but also for the maintainer. Consistently not using parenthesis and relying on precedence leaves an ambiguity whereas someone who consistently uses them is also clear in their intent if they omit them.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • So much reading 😀

    Excellent question, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Good question and explanation.

    In my experience many developers and dbas are unaware of operator precedence for other than arithmetic or boolean operations - perhaps because they pay only lip service to set-oriented thinking. So it's nice to see a queston on precedence for set-oriented operators.

    Tom

  • Good to know about the precedence, thanks.

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply