Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Is there a difference between these two queries?
  2. SELECT * FROM table WHERE column1 = 'x' OR column2 = 'x'
  3.  
  4. SELECT * FROM table WHERE (column1 = 'x' OR column2 = 'x')
  5.        
  6. SELECT * FROM table WHERE id=1 AND column1 = 'x' OR column2 = 'x'
  7.        
  8. SELECT * FROM table WHERE id=1 AND (column1 = 'x' OR column2 = 'x')
  9.        
  10. SELECT * FROM table WHERE id=1 AND column1 = 'x' OR column2 = 'x'
  11.        
  12. SELECT * FROM table WHERE (id=1 AND column1 = 'x') OR column2 = 'x'