SQL Apprentice Question
Do you have any suggest or guide lines to help me to understand the better
way for naming tables & fields ?
Normally, I name the pk of all tables with : ID and the fk with :
ID+TableName
Example:
Table: Authors
id (pk)
AuthorName
Table: Book
id (pk)
idAuthor (fk)
Title
It's correct ?
Celko Answers
>> Do you have any suggest or guide lines to help me to understand the better way for naming tables & fields [sic] ? <<
Columns are not fields -- major difference!.
Look at the ISO-11179 Standards for metadata and data element names.
The basic priniciple is to name a thing for what it is, not how it is
used, where is located or how it is stored.
I have an entire book, SQL PROGRAMMING STYLE on this topic, with rules
and guide lines.
>> Is it correct ? <<
Completely wrong
1) you have TWO names for the same data element
2) the word "id" is a modifier for an attribute. Identifer of what??
3) you avoid any industry standards -- use ISBN and not "book_id"
Monday, June 19, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment