Other Performance Considerations

There are other performance considerations that should be noted when tuning SQL statements. The following concepts are discussed in the next sections:

  • Using the LIKE operator and wildcards

  • Avoiding the OR operator

  • Avoiding the HAVING clause

  • Avoiding large sort operations

  • Using stored procedures

Using the LIKE Operator and Wildcards

The LIKE operator is a useful tool that is used to place conditions on a query in a flexible manner. The placement and use of wildcards in a query can eliminate many possibilities of data that should be retrieved. Wildcards are very flexible for queries that search for similar data (data that is not equivalent to an exact value specified).

Suppose you want to write a query using the ...

Get Sams Teach Yourself SQL in 24 Hours, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.