Home | Previous Page | Next Page   Selecting Data from Complex Types (IDS) > Selecting Rows Within a Table Hierarchy >

Selecting Rows of the Supertable without the ONLY Keyword

A table hierarchy allows you to construct, in a single SQL statement, a query whose scope is a supertable and its subtables. A query on a supertable returns rows from both the supertable and its subtables. Figure 157 shows a query on the person table, which is the root supertable in the table hierarchy.

Figure 157. Query
SELECT * FROM person

Figure 35 returns all columns in the supertable and those columns in subtables (employee and sales_rep) that are inherited from the supertable. A query on a supertable does not return columns from subtables that are not in the supertable. Figure 158 shows the name, address, and soc_sec columns in the person, employee, and sales_rep tables.

Figure 158. Query Result
name        Rogers, J.
address     ROW(102 Ruby Ave, Belmont, CA, 69055)
soc_sec     454849344

name        Sallie, A. 
address     ROW(134 Rose St, San Carlos, CA, 69025)
soc_sec     348441214

·
·
·
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]