LIMITED OFFER
Save 50% on book bundles
Immediately download your ebook while waiting for your print delivery. No promo code needed.
Are you an SQL programmer that, like many, came to SQL after learning and writing procedural or object-oriented code? Or have switched jobs to where a different brand of SQL is… Read more
LIMITED OFFER
Immediately download your ebook while waiting for your print delivery. No promo code needed.
Introduction
1.1 Purpose of the Book
1.2 Acknowledgments
1.3 Corrections, Comments, and Future Editions
Chapter 1: Names and Data Elements
1.1 Names
1.2 Follow the ISO-11179 Standards Naming Conventions
1.3 Problems in Naming Data Elements
Chapter 2: Fonts, Punctuation, and Spacing
2.1 Typography and Code
2.2 Word Spacing
2.3 Follow Normal Punctuation Rules
2.4 Use Full Reserved Words
2.5 Avoid Proprietary Reserved Words if a Standard Keyword Is Available in Your SQL Product
2.6 Avoid Proprietary Statements if a Standard Statement Is Available
2.7 Rivers and Vertical Spacing
2.8 Indentation
2.9 Use Line Spacing to Group Statements
Chapter 3: Data Declaration Language
3.1 Put the Default in the Right Place
3.2 The Default Value Should Be the Same Data Type as the Column
3.3 Do Not Use Proprietary Data Types
3.4 Place the PRIMARY KEY Declaration at the Start of the CREATE TABLE Statement
3.5 Order the Columns in a Logical Sequence and Cluster Them in Logical Groups
3.6 Indent Referential Constraints and Actions under the Data Type
3.7 Give Constraints Names in the Production Code
3.8 Put CHECK() Constraint Near what they Check
3.9 Put Multiple Column Constraints as Near to Both Columns as Possible
3.10 Put Table-Level CHECK() Constraints at the End of the Table Declaration
3.11 Use CREATE ASSERTION for Multi-table Constraints
3.12 Keep CHECK() Constraints Single Purposed
3.13 Every Table Must Have a Key to Be a Table
3.14 Do Not Split Attributes
3.15 Do Not Use Object-Oriented Design for an RDBMS
Chapter 4: Scales and Measurements
4.1 Measurement Theory
4.2 Types of Scales
4.3 Using Scales
4.4 Scale Conversion
4.5 Derived Units
4.6 Punctuation and Standard Units
4.7 General Guidelines for Using Scales in a Database
Chapter 5: Data Encoding Schemes
5.1 Bad Encoding Schemes
5.2 Encoding Scheme Types
5.3 General Guidelines for Designing Encoding Schemes
5.4 Multiple Character Sets
Chapter 6: Coding Choices
6.1 Pick Standard Constructions over Proprietary Constructions
6.2 Pick Compact Constructions over Longer Equivalents
6.3 Use Comments
6.4 Avoid Optimizer Hints
6.5 Avoid Triggers in Favor of DRI Actions
6.6 Use SQL Stored Procedures
6.7 Avoid User-Defined Functions and Extensions inside the Database
6.8 Avoid Excessive Secondary Indexes
6.9 Avoid Correlated Subqueries
6.10 Avoid UNIONS
6.11 Testing SQL
Chapter 7: How to Use Views
7.1 VIEW Naming Conventions Are the Same as Tables
7.2 VIEWs Provide Row- and Column-Level Security
7.3 VIEWs Ensure Efficient Access Paths
7.4 VIEWs Mask Complexity from the User
7.5 VIEWs Ensure Proper Data Derivation
7.6 VIEWs Rename Tables and/or Columns
7.7 VIEWs Enforce Complicated Integrity Constraints
7.8 Updatable VIEWs
7.9 Have a Reason for Each VIEW
7.10 Avoid VIEW Proliferation
7.11 Synchronize VIΕWs with Base Tables
7.12 Improper Use of VIEWs
7.13 Learn about Materialized VIEWs
Chapter 8: How to Write Stored Procedures
8.1 Most SQL 4GLs Are Not for Applications
8.2 Basic Software Engineering
8.3 Use Classic Structured Programming
8.4 Avoid Portability Problems
8.5 Scalar versus Structured Parameters
8.6 Avoid Dynamic SQL
Chapter 9: Heuristics
9.1 Put the Specification into a Clear Statement
9.2 Add the Words “Set of All . . ./” in Front of the Nouns
9.3 Remove Active Verbs from the Problem Statement
9.4 You Can Still Use Stubs
9.5 Do Not Worry about Displaying the Data
9.6 Your First Attempts Need Special Handling
9.7 Do Not Think with Boxes and Arrows
9.8 Draw Circles and Set Diagrams
9.9 Learn Your Dialect
9.10 Imagine That Your WHERE Clause Is “Super Ameba”
9.11 Use the Newsgroups and Internet
Chapter 10: Thinking in SQL
10.1 Bad Programming in SQL and Procedural Languages
10.2 Thinking of Columns as Fields
10.3 Thinking in Processes, Not Declarations
10.4 Thinking the Schema Should Look Like the Input Forms
Resources
Military Standards
Metadata Standards
ANSI and ISO Standards
U.S. Government Codes
Retail Industry
Code Formatting and Naming Conventions
Bibliography
Reading Psychology
Programming Considerations
Index
About the author
JC
Mr. Celko is author a series of books on SQL and RDBMS for Elsevier/MKP. He is an independent consultant based in Austin, Texas.
He has written over 1200 columns in the computer trade and academic press, mostly dealing with data and databases.