Name

CREATE

Synopsis

CREATE TABLE name field_name field_type, [field2 type2, ...]
CREATE SEQUENCE ON table [STEP value] [VALUE value]
CREATE INDEX name ON table ( column, ... )

Creates new database elements (or entirely new databases). This statement is used to create tables, indices, and sequences.

The CREATE SEQUENCE statement adds a sequence to a table. A sequence is simply a value associated with a table that the mSQL server keeps track of. Most commonly, a sequence is used to generate unique identification numbers for tables. The value of the sequence is incremented every time the sequence value is read. The STEP modifier determines how much the sequence value is increased each time. The VALUE modifier gives the initial value of the sequence.

The CREATE INDEX statement defines an index for the table. The mSQL system supports indexes that contain more than one field. You must provide a name for the index, although it need not be meaningful because it is rarely needed by the end user.

The CREATE TABLE statement defines the structure of a table within the database. This statement is how all mSQL tables are created. The syntax of the create definition is the name of a field followed by the type of the field, followed by any modifiers (e.g., name char(30) not null). The following datatypes are supported by mSQL:

CHAR( length)

Fixed length character value. No values can be greater than the given length.

DATE

Standard date type.

INT

Standard 4-byte integer. Range is -2147483646 to 2147483647. ...

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.