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

Home > Blogs > Chris Fehily

RSS Feed Subscribe  RSS details

Avoiding division by zero with NULLIF, Five SQL Tips in Five Days, Part 5

Suppose you want to calculate the male–female ratios for various school clubs, but you discover that the following query fails and issues a divide-by-zero error when it tries to calculate ratio for the Lord of the Rings Club, which has no women:

Continue reading...

By Chris FehilyCommentsJuly 25, 2008
Topics: Productivity

Ordering values for IN expressions, Five SQL Tips in Five Days, Part 4

To speed the evaluation of IN expressions, list the most likely values first.

Continue reading...

By Chris FehilyCommentsJuly 24, 2008
Topics: Productivity

Specifying endpoints for BETWEEN expressions, Five SQL Tips in Five Days, Part 3

Specifying a character range for a BETWEEN expression often needs some thought.

Continue reading...

By Chris FehilyCommentsJuly 23, 2008
Topics: Productivity

Confusing AND and OR, Five SQL Tips in Five Days, Part 2

It's easy to translate a correctly phrased spoken-language statement into an incorrect SQL statement.

Continue reading...

By Chris FehilyCommentsJuly 22, 2008
Topics: Productivity

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

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

Continue reading...

By Chris FehilyCommentsJuly 21, 2008
Topics: Productivity