CHAPTER 3 Data Declaration Language
“[I need] Data! Data! Data! I can’t make bricks without clay.”—Sherlock Holmes(fictional detective of author Sir Arthur Conan Doyle)
“Smart data structures and dumb code works a lot betterthan the other way round.”—Eric S. Raymond
I BELIEVE THAT MOST of the bad SQL queries in the world are the result of bad schema design. A bad schema can be ambiguous, require extra work to fetch data, and not return valid results even when good data was input into it.
Let’s start with the syntax rules that should be followed when writing data declaration language (DDL), and then in the following chapters, talk about the content and semantics of the DDL.
3.1 Put the Default in the Right Place
Rationale:
The DEFAULT constraint ...
Get Joe Celko's SQL Programming Style 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.