Summary

This chapter has introduced some real-world SQL as well as cautions on common mistakes. The first section includes the following:

  • Thinking conditionally— using CASE, COALESCE, and variants of these two keywords to make IF-like choices

  • Formatting and displaying data— learning how to split columns, how to join columns, and how to convert columns from one datatype to another

  • Playing with patterns— handling uppercase/lowercase issues, using complex expressions in predicates, and working with date data

The second section gives examples of common mistakes:

  • Mixing up DISTINCTs

  • Creating report-style displays

  • Finding the “first” row

For more information on these topics, see Appendix E, Resources.

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.