[Pdx-pm] (OT) SQL style question

Ovid publiustemp-pdxpm at yahoo.com
Thu Jan 13 14:02:06 PST 2005


Hi all,

Sorry for the OT question (well, it's not completely OT as this impacts
how Bricolage 2.0 will be implemented.)

We have views that reference more than one table.  Our views have a
primary table they are based upon and fields from "non-primary tables."
 To make it very clear which fields are which, there's been a bit of
discussion regarding how to make it visually distinct that a particular
field is from a table that is not the primary table of the view.  Which
of the following is clearer?

Using double underscores to separate the other table name from its
field name:

  SELECT id, 
         first_name, 
         last_name, 
         other_table__id, 
         other_table__name
  FROM   some_view

Quoting column names and using periods as separators:

  SELECT "id", 
         "first_name", 
         "last_name", 
         "other_table.id", 
         "other_table.name"
  FROM   some_view

Is the latter portable?  Is the former too confusing?  Which is easier
to read?  Are there reasonable alternatives?

Cheers,
Ovid

=====
Silence is Evil            http://users.easystreet.com/ovid/philosophy/decency.html
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list