3.3.1 Basic table structure

Organization of this subsection
(1) Rows and columns
(2) Data types

(1) Rows and columns

The cells in a table's horizontal plane constitute rows; the cells in the vertical plane constitute columns. The row is the unit for performing operations on a table. Each row consists of data entries from one or more columns. Each column is given a column name. When an operation is performed on a table, you identify the position of an item in a row by its column name. The following figure shows the structure of a table.

Figure 3-4 Example of a table

[Figure]

Explanation
This example illustrates the structure of an inventory table (the table name is STOCK). The columns are defined with the CREATE TABLE in the definition SQL. Following is the definition of the STOCK table's columns:

CREATE TABLE STOCK
  (PCODE CHAR(4),
   PNAME NCHAR(8),
   COLOR NCHAR(1)
   PRICE INTEGER,
   SQUANTITY INTEGER);

(2) Data types

A data type must be specified for each column and for each attribute comprising an abstract data type. Data types are classified broadly as predefined data types and user-defined data types. A predefined data type is provided by HiRDB. A user-defined data type is defined by a user as needed. The following table lists the available data types.

Table 3-3 Available data types

ClassificationData typeData format
PredefinedNumeric dataINTEGERInteger
SMALLINTInteger
LARGE DECIMALFixed point
FLOATDouble-precision floating point
SMALLFLTSingle-precision floating point
Character dataCHARACTERFixed-size character string
VARCHARVariable-size character string
National character dataNCHARFixed-size national character string
NVARCHARVariable-size national character string
Mixed character dataMCHARFixed-size mixed character string
MVARCHARVariable-size mixed character string
Date dataDATEDate
Time dataTIMETime
Time-stamp dataTIMESTAMPPrecision for time-stamp data in floating-point seconds
Date interval dataINTERVAL YEAR TO DAYDate interval
Time interval dataINTERVAL HOUR TO SECONDTime interval
Large object dataBLOBBinary data string
Binary dataBINARYBinary data string
Boolean dataBOOLEANBoolean value
User-definedAbstract data type----

--: Not applicable

Data types are specified when a table is created with the CREATE TABLE of the definition SQL. The data type for an attribute comprising an abstract data type is specified with the CREATE TYPE of the definition SQL. For details about abstract data types, see Section 3.5 Expansion into an object relational database.