Object Tables   «Prev  Next»

Lesson 7 Practical examples
ObjectiveWrite SQL to Query Object Tables (technique 1)

Write SQL to Query Object Tables

To query a row or a column object table, you can use standard SQL normally used in querying relational tables.
The following example uses standard SQL to query the CUSTOMER_OBJ_TABLE table:

SELECT cust_id, first_name, last_name
FROM customer_obj_table ;

In this example, we query the object just like a normal relational table.
The following diagram illustrates the variables in the syntax:

SQL Syntax
  1. The SELECT clause, used for selecting attributes (in this case, columns) from the object table.
  2. The FROM clause, used for specifying the name of the object table.
  3. The WHERE clause, used for specifying the criteria for selection from the object table.

SELECT column_name_1  (column_name_2)
FROM object_table_name alias 
WHERE (clause);

Practical SQL
The following diagram shows an example of querying an object table:

select, from, where
  1. The SELECT clause
  2. The FROM clause
  3. The WHERE clause
SELECT product_id, product_name
FROM product_obj_table
WHERE product_id=39;

Select, From, Where Clause
In the next lesson, an alternative way of writing SQL to query an object table will be discussed.