Selecting Subtype Data

Previous Next

In the SQL statements you write, you may refer to a subtype as if it were a separate table. From a subtype, you can select:

· All supertype columns.

 

· All columns of the subtype.

 

· All subtype indicators of the constellation, since these are attributes of the supertype.

This applies whether your subtype data is stored in the same table as the supertype data or in separate database tables. Set the Create Separate Tables attribute to determine how subtype data should be stored.

EXAMPLE 1:

If Persons can be Guides, then:

SELECT *

FROM guide

will not only select ALL Guide (subtype) attributes table but also ALL Person (supertype) attributes.

EXAMPLE 2:

If Persons can be Guides or Staff (subtype set Occupation), and they can be Male or Female (subtype set Gender), then you can retrieve all highly experienced female guides with the following statement:

SELECT *

FROM guide

WHERE experience = 'High'

AND female = 'Y'

In this example, Female is a subtype indicator of the Person supertype table.