How do you name table/structure elements?
Ruud Harmsen
ruud at targon.UUCP
Mon Jan 22 20:09:08 AEST 1990
In article <27885 at sequent.UUCP> jsc at crg4.UUCP (J. Scott Carr) writes:
>My preference is to prepend text that identifies the object the
>column belongs to. The intention is that the core of the field name
>represents the attribute, the prefix the object. This is most important
>with keys. For example, part number in a parts table and a orders table
>are the same attribute. Naming the columns PRT_PARTNO and ORD_PARTNO
>helps clarify complex selects and joins, as well as the data dictionary.
I disagree. Especially in the data dictionary this won't clarify things,
but rather mistifies them, because it won't be clear that most of what
you could describe about PRT_PARTNO is also valid for ORD_PARTNO, unless
you duplicate the description, or maintain pointers in the text.
I think PARTNO is the "data element", and should therefore be the basis
for the datadictionary. PARTNO as occurring in ORD and PRT are "data items".
I think that it is superfluous to prepend anything, because both in the
programming language and in the database query language a reference to
the object is already there:
- E.g. in C, you would have a structure type corresponding to the object.
so you write: prt.partno and ord.partno (or something similar with ->)
- In SQL, the join can be done with something like:
... WHERE PRT.PARTNO = ORD.PARTNO
where PRT and ORD identify the tables, and PARTNO the attributes.
More information about the Comp.lang.c
mailing list