Problem

Writing efficient SQL queries for DB2 can be tricky. Some general SQL guidelines apply, and there are also specific practices that apply only to DB2.

Solution

Here is a list of tips you can use to write good queries:

  • Avoid in your queries. Instead, state the columns you want to select.
  • Use the consistent acronyms to alias your table names (makes it easier to read joins)
  • Use to limit the results set
  • Use or instead of

References