Recent PostsRecent Posts Popular TopicsPopular Topics
 Home Search Members Calendar Who's On

 Logic Precedence Rate Topic Display Mode Topic Options
Author
 Message
 Posted Wednesday, February 12, 2014 2:20 AM
 Ten Centuries Group: General Forum Members Last Login: Yesterday @ 6:32 AM Points: 1,342, Visits: 2,565
 very good question for the beginners to understand what OR , AND does.Thanks for sharing ..
Post #1540591
 Posted Wednesday, February 12, 2014 3:31 AM
 Ten Centuries Group: General Forum Members Last Login: Wednesday, November 23, 2016 1:21 AM Points: 1,030, Visits: 955
 Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.
Post #1540604
 Posted Wednesday, February 12, 2014 3:45 AM
 Ten Centuries Group: General Forum Members Last Login: Thursday, November 24, 2016 1:51 AM Points: 1,060, Visits: 2,644
 david.wright-948385 (2/12/2014)Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.+1
Post #1540607
 Posted Wednesday, February 12, 2014 4:11 AM
 SSCertifiable Group: General Forum Members Last Login: Yesterday @ 12:52 AM Points: 5,364, Visits: 7,073
 david.wright-948385 (2/12/2014)Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.Parenthesis prevent uncertainty (and possible misunderstanding)Thanks for the easy one today, Steve ____________________________________________Space, the final frontier? not any more...All limits henceforth are self-imposed.“libera tute vulgaris ex”
Post #1540621
 Posted Wednesday, February 12, 2014 5:03 AM
 SSCrazy Eights Group: General Forum Members Last Login: Today @ 3:55 PM Points: 9,972, Visits: 9,378
 It was a simple question, but nonetheless a good one. How many times have we all been tripped up somewhere and spent hours on it, only to find that the problem was something so simple that we don't even want to admit it to ourselves? Always good to keep the basics in mind, no matter how far back they get.
Post #1540654
 Posted Wednesday, February 12, 2014 6:44 AM
 SSCrazy Group: General Forum Members Last Login: Wednesday, November 30, 2016 2:06 AM Points: 2,251, Visits: 8,029
 Didn't know whether OR or AND had priority, so guessed (correctly )It's not something I've ever really needed to know, doesn't everyone use brackets in cases like this, to make it clear what is meant?
Post #1540700
 Posted Wednesday, February 12, 2014 7:29 AM
 SSCommitted Group: General Forum Members Last Login: Wednesday, December 7, 2016 3:15 PM Points: 1,860, Visits: 2,656
 david.wright-948385 (2/12/2014)Always add brackets when mixing operators. Even if you know the rules, brackets make a calculation less prone to misunderstanding.Until you have several layers of brackets, at which point pairing them up can become as difficult as parsing the text. This can be alleviated by formatting, e.g:`WHERE ( (a = b) OR (b = c) ) AND ( (c = d) OR ( (d = e) AND (e = f) ) )`as opposed to `WHERE ((a = b) OR (b = c)) AND ((c = d) OR ((d = e) AND (e = f)))`The latter, of course, being the type of code outputted by Microsoft's query designers on a regular basis...
Post #1540725
 Posted Wednesday, February 12, 2014 7:46 AM
 SSC-Insane Group: General Forum Members Last Login: Yesterday @ 2:52 PM Points: 20,083, Visits: 18,257
 twin.devil (2/12/2014)very good question for the beginners to understand what OR , AND does.Thanks for sharing ..Yes - and even for the experienced to remind them of the order of operations. Jason AKA CirqueDeSQLeilI have given a name to my pain...MCM SQL Server, MVPSQL RNNRPosting Performance Based Questions - Gail Shaw
Post #1540733
 Posted Wednesday, February 12, 2014 7:55 AM
 Ten Centuries Group: General Forum Members Last Login: Wednesday, November 23, 2016 1:21 AM Points: 1,030, Visits: 955
 sknox (2/12/2014)...This can be alleviated by formatting, e.g:`WHERE ( (a = b) OR (b = c) ) AND ...`as opposed to `WHERE ((a = b) OR (b = c)) AND ((c = d) OR ((d = e) AND (e = f)))`Exactly. IMHO, this goes for general query layout too.
Post #1540744
 Posted Wednesday, February 12, 2014 8:02 AM
 SSC-Insane Group: General Forum Members Last Login: Yesterday @ 2:52 PM Points: 20,083, Visits: 18,257
 david.wright-948385 (2/12/2014)sknox (2/12/2014)...This can be alleviated by formatting, e.g:`WHERE ( (a = b) OR (b = c) ) AND ...`as opposed to `WHERE ((a = b) OR (b = c)) AND ((c = d) OR ((d = e) AND (e = f)))`Exactly. IMHO, this goes for general query layout too.+10 Jason AKA CirqueDeSQLeilI have given a name to my pain...MCM SQL Server, MVPSQL RNNRPosting Performance Based Questions - Gail Shaw
Post #1540753

 Permissions