30.06.2013 Views

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1: Writing Readable <strong>SQL</strong><br />

• property term: these represent the category of the data.<br />

Examples: Total_Amount, Date, Sequence, LastName, TotalAmount, Period,<br />

Size, Height.<br />

• qualifiers: these can be used, if necessary, to describe the data element and make it<br />

unique within a specified context; they need appear in no particular order, but they<br />

must precede the term being qualified; qualifier terms are optional.<br />

Examples: Budget_Period, FinancialYear, LastName.<br />

• the representation term: this describes the representation of the valid value set<br />

of the data element. It will be a word like "Text," "Number," "Amount," "Name,"<br />

"Measure" or "Quantity." There should be only one, as the final part of the name,<br />

and it should add precision to the preceding terms.<br />

Examples: ProductClassIdentifier, CountryIdentifierCode,<br />

ShoeSizeMetric.<br />

The type of separator used between words should be consistent, but will depend on the<br />

language being used. For example, the CamelCase convention is much easier for speakers<br />

of Germanic or Dutch languages, whereas hyphens fit better with English.<br />

It isn't always easy to come up with a word to attach to a table.<br />

Not all ideas are simply expressed in a natural language, either. For example, "women between the ages of<br />

15 and 45 who have had at least one live birth in the last 12 months" is a valid object class not easily named<br />

in English.<br />

ISO/IEC 11179-1:2004(E): Page 19.<br />

You can see from these simple rules that naming conventions have to cover semantics<br />

(the meaning to be conveyed), the syntax (ordering items in a consistent order), lexical<br />

issues (word form and vocabulary), and uniqueness. A naming convention will have a<br />

scope (per application? company-wide? national? international?) and an authority (who<br />

supervises and enforces the conventions?).<br />

26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!