Xref: utzoo comp.databases:4747 comp.lang.c:25321 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!targon!ruud From: ruud@targon.UUCP (Ruud Harmsen) Newsgroups: comp.databases,comp.lang.c Subject: Re: How do you name table/structure elements? Message-ID: <947@targon.UUCP> Date: 22 Jan 90 09:09:08 GMT References: <1990Jan16.170217.16718@aqdata.uucp> <27885@sequent.UUCP> Reply-To: ruud@targon.UUCP (Ruud Harmsen) Organization: Nixdorf Computer BV., SWP, P.O. Box 29,Vianen, The Netherlands Lines: 24 In article <27885@sequent.UUCP> jsc@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.