Publishers of technology books, eBooks, and videos for creative people

Home > Blogs > Simplifying comparisons, Five SQL Tips in Five Days, Part 1

Simplifying comparisons, Five SQL Tips in Five Days, Part 1

By  Jul 21, 2008

Topics: Productivity

For speedier comparisons, fold your constants into a minimal number of expressions.

For example, change

Try to put only simple column references to the left of the comparison operator and more-complex expressions to the right. In general, the fastest comparison is for equality (=), following by the inequalities (<, <=, >, >=). The slowest is not-equal (<>). If possible, express conditions by using faster comparisons.

Check back here each day this week for more SQL tips.

And for more on SQL, be sure to check out my book SQL: Visual QuickStart Guide, 3rd Edition.