Using computed columns  Indexes on computed columns

Chapter 8: Creating Databases and Tables

Computed columns example

A computed column is defined by an expression.You can build the expression by combining regular columns in the same row. Expressions may contain functions, arithmetic operators, case expressions, other columns from the same table, global variables, Java objects, and path expressions. For example:

CREATE TABLE parts_table
  (part_no Part.Part_No, name CHAR(30),
  descr TEXT, spec IMAGE, listPrice MONEY,
      quantity INT,
   name_order COMPUTE name_order(part_no)
   version_order COMPUTE part_no>>version,
   descr_index COMPUTE des_index(descr), 
   spec_index COMPUTE xml_index(spec)
   total_cost COMPUTE quantity*listPrice
)

In this section:





Copyright © 2005. Sybase Inc. All rights reserved. Indexes on computed columns

View this book as PDF