Thread: "Subclassing" in SQL

"Subclassing" in SQL

From
Andrew Perrin
Date:
I hope that title line is reasonably accurate. Here's what I'm trying to
do, and would love it anyone can provide guidance.

I have a table of utterances in a focus group setting; each record
contains an identifier for the speaker and group, as well as the length of
the utterance (in words) and then several boolean variables, each
representing whether a substantive concept is present in the utterance or
not.  The trouble is that some of these concept variables (called
'codes') really are subsets of one another. For example, one code (called
`cd_interest') is a particular instance of another code (called
'cd_pragmatic').  My question is whether there is any way to represent
this relationship in SQL, without changing the underlying data. That is, I
don't want to simply do:

UPDATE statements SET cd_pragmatic = 't' WHERE cd_interest;

because it's theoretically possible for me to change this conceptual
relationship in the future.  What I think I'm looking for is some sort of
a join that will cause postgres to consider cd_pragmatic as True whenever
cd_interest is true.

Any thoughts?

----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology  
Chapel Hill, North Carolina, USA - http://demog.berkeley.edu/~aperrin       aperrin@socrates.berkeley.edu -
aperrin@igc.apc.org