Using the system table COLUMNS, you can determine the following database information, among other things:
·
Columns of table
RESERVATION in the sequence in which they were defined, together with the
relevant comments
SELECT
columnname, comment
FROM DOMAIN.COLUMNS
WHERE tablename = 'RESERVATION' ORDER BY
pos
·
Data types of all columns
of table CUSTOMER
SELECT
columnname, datatype, len, dec, codetype
FROM DOMAIN.COLUMNS
WHERE tablename = 'CUSTOMER'
·
All columns of your own
Basis tables that have the data type DATE
SELECT
tablename,columnname
FROM DOMAIN.COLUMNS
WHERE owner = user
AND tabletype = 'TABLE'
AND datatype = 'DATE'
·
All columns of your own
table HOTEL for which a default value was defined, plus this default value
SELECT
columnname, default
FROM DOMAIN.COLUMNS
WHERE owner = user
AND tablename = 'HOTEL'
AND default IS NOT NULL
·
All primary table columns
of table ROOM, sorted according to their sequence in the primary key
SELECT
columnname
FROM DOMAIN.COLUMNS
WHERE tablename = 'ROOM' AND mode = 'KEY' ORDER BY
keypos
·
All columns defined with
NOT NULL of table CUSTOMER
SELECT
columnname
FROM DOMAIN.COLUMNS
WHERE tablename = 'CUSTOMER' AND mode =
'MAN'
·
All columns of table
RESERVATION that can be changed by the current user
SELECT
columnname
FROM DOMAIN.COLUMNS
WHERE tablename = 'RESERVATION' AND columnprivileges
LIKE '*UPD*'
·
All columns of table
RESERVATION that can be changed by the current user and for which the user can
pass on this privilege
SELECT
columnname
FROM DOMAIN.COLUMNS
WHERE tablename = 'RESERVATION' AND columnprivileges
LIKE '*UPD+*'
·
All table columns that
were specified as MYDOMAIN during definition of the domain
SELECT
owner, tablename, columnname
FROM DOMAIN.COLUMNS
WHERE domainname = 'MYDOMAIN'
Columns in the index: see INDEXCOLUMNS
Columns in the referential constraint: see FOREIGNKEYCOLUMNS
Primary table or view table columns in the view table: see VIEWCOLUMNS