SQL/MX 2.x Installation and Management Guide (G06.24+, H06.03+)
Creating an SQL/MX Database
HP NonStop SQL/MX Installation and Management Guide—523723-004
7-21
Managing Table Data
When you define a column, you specify the column name, data type, and, optionally,
other column attributes. To define columns for a table, you can specify the column
definitions in the CREATE TABLE statement or in the ALTER TABLE with the ADD
COLUMN clause. However, HP recommends that you avoid using the ALTER TABLE
with the ADD clause if possible insofar as table performance is degraded by adding
columns.
Specifying Column Names
•
A column name is an SQL identifier that can be up to 128 characters in length. The
column name must begin with a letter unless it is delimited by double quotes. It
must be unique among column names. It cannot be a reserved word unless it is
delimited by double quotes. Regular SQL identifiers are not case-sensitive but
delimited names are. For more information about SQL identifiers and SQL/MX
reserved words, see the SQL/MX Reference Manual.
•
Use descriptive column names for your application to help programmers and users
remember the names correctly.
•
Nondelimited column names can be specified in the CREATE TABLE statement in
any combination of uppercase and lowercase letters. For example, these three
column names are equivalent: LOCATION, Location, and location.
Specifying Data Types for Columns
Each column in a table is associated with a data type. These basic formats of data can
be stored in columns:
•
Character data
•
Numeric data
•
Datetime data
•
Time interval data
When determining the data type and attributes for a column, consider these guidelines:
•
NonStop SQL/MX supports the ISO88591 character set and several other
character sets for character data. For more information, see Defining Character
Data on page 7-23.
•
Specify a column default value for each column. See Using Default and Null
Values on page 7-28.
•
Specify the HEADING and UPSHIFT attributes for your application’s use, if
applicable. For more information, see Specifying Column Attributes on page 7-30.
•
Collation of numeric values occurs with negative numbers preceding positive
numbers.
•
For the purpose of sorting, the null value is considered to be greater than all other
values.