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-11
Creating SQL/MX Tables
Creating SQL/MX Tables
Tables are the foundation of an SQL/MX database. All data physically resides in tables.
When you create a table with the CREATE TABLE statement, you specify the definition
of each data column and the attributes of the physical file in which the table is to be
stored. Carefully consider the file attributes to ensure that the table meets the needs of
your application.
The CREATE TABLE statement stores the table definition in the definition schema of
the table’s catalog and creates the table, which physically exists as one or more disk
files.
All Guardian files underlying SQL/MX objects use the key-sequenced file organization
with format 2. You cannot use entry-sequenced or relative organizations with SQL/MX
tables. Before creating an SQL/MX table, you should understand the key-sequenced
type of table organizations and column, key, and index design considerations. For
more information, see Section 4, Understanding and Planning SQL/MX Tables.
For information about loading tables, see the guidelines for loading tables in
Section 10, Reorganizing SQL/MX Tables and Maintaining Data.
Security Rules for Creating and Altering SQL/MX Tables
Table security ultimately defines much of the security for indexes and views.
The rules for creating and altering tables are:
•
To create an SQL/MX table or other object (including index, view, SPJ, or SQL/MP
alias), you must own its schema or be a super ID user acting on behalf of the
owner.
•
To alter a table, you must own its schema or be a super ID user acting on behalf of
the owner.
For more information about security and access privileges for tables and other
SQL/MX database objects, see Access Privileges for SQL/MX Database Objects on
page 7-9.
Creating and Using Keys
Create and use these keys for SQL/MX tables and their indexes:
•
Primary key. See Creating and Using a Primary Key on page 7-12.
•
Clustering key. See Creating and Using a Clustering Key on page 7-12.
•
SYSKEY. See Using the SYSKEY on page 7-14.
Note. To create SQL/MX tables and build an SQL/MX database, you must purchase and install
the SQL/MX DDL License product on your system. For more information about this license
,
see Section 2, Preparing to Install NonStop SQL/MX.