TABLE
Syntax
T[ABLE] [ tablename ] ;
Description
The TABLE statement with no argument displays a list of all the user tables in the database that are owned by the current user.
With the tablename argument, the TABLE statement displays a brief description of the columns in the specified table.
Examples
You can use the TABLE statement to see the structure of system tables. Unless you are logged in as the c-treeSQL database administrator (the user ADMIN, by default), you need to qualify the system table name with the administrator user name, as in the following example:
ISQL> table ADMIN.systables
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
id NOT NULL INT 4
tbl NOT NULL VARCHAR 32
creator NOT NULL VARCHAR 32
owner NOT NULL VARCHAR 32
tbltype NOT NULL VARCHAR 1
tblpctfree NOT NULL INT 4
segid NOT NULL INT 4
has_pcnstrs NOT NULL VARCHAR 1
has_fcnstrs NOT NULL VARCHAR 1
has_ccnstrs NOT NULL VARCHAR 1
has_ucnstrs NOT NULL VARCHAR 1
tbl_status NOT NULL VARCHAR 1
rssid NOT NULL INT 4
The following example uses the TABLE command to detail the structure of the tables used in examples throughout this chapter.
ISQL> table - List the sample tables
TABLENAME
---------
customers
lot_staging
lots
orders
quality
samples
ISQL> table customers
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
customer_id NOT NULL INT 4
customer_name CHAR 50
customer_street CHAR 100
customer_city CHAR 50
customer_state CHAR 10
customer_zip CHAR 5
ISQL> table orders
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
order_id NOT NULL INT 4
customer_id INT 4
steel_type CHAR 20
order_info CHAR 200
order_weight INT 4
order_value INT 4
order_state CHAR 20
ISQL> table lots
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
lot_id NOT NULL INT 4
order_id NOT NULL INT 4
lot_units INT 4
lot_info CHAR 200
ISQL> table lot_staging
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
lot_id INT 4
lot_location CHAR 20
start_date DATE
end_date DATE
issues CHAR 200
ISQL> table quality
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
lot_id NOT NULL INT 4
purity DOUBLE 8
p_deviation DOUBLE 8
strength DOUBLE 8
s_deviation DOUBLE 8
comments CHAR 200
ISQL> table samples
COLNAME NULL ? TYPE LENGTH
------- ------ ---- ------
lot_id INT 4
samples INT 4
comments CHAR 200
ISQL>