Entering content frame

 TABLES 

Using the system table TABLES, you can determine the following database information, among other things:

·        All tables, view tables and synonyms for which the current user can execute SELECT statements
SELECT owner, tablename
  FROM DOMAIN.TABLES
    WHERE privileges LIKE '*SEL*'

·        All result tables of the current user
SELECT tablename
  FROM DOMAIN.TABLES
    WHERE type = 'RESULT'

·        All the user’s own tables for which the last update statistics run is more than 30 days in the past
SELECT tablename, updstatdate
  FROM DOMAIN.TABLES
    WHERE updstatdate <= subdate (DATE,30)

·        Information on which sample values are used to carry out an update statistics run on table CUSTOMER
SELECT sample_percent, sample_rows
  FROM DOMAIN.TABLES
    WHERE tablename = 'CUSTOMER'

·        Internal identification of table HOTEL
SELECT tableid
  FROM DOMAIN.TABLES
    WHERE tablename = 'HOTEL'
If this relates to a Basis table, the internal identification of a table can be used, for example, during the lock query (see LOCKS).

Table definition: see COLUMNS

Primary key: COLUMNS

Synonym for a table: see SYNONYMS

Table privilege: see TABLEPRIVILEGES

Table in a view definition: see VIEWCOLUMNS

Constraint of a column or table: see CONSTRAINTS

Referential constraint: see FOREIGNKEYS

Index: see INDEXES

View table: VIEWS

Secondary key: see FOREIGNKEYCOLUMNS

Trigger: see TRIGGERS

 

Leaving content frame