Skip to main content Link Menu Expand (external link) Document Search Copy Copied

CREATE TABLE statement

Create a FeatureBase table with the specified columns and data types.

BNF diagrams

expr

COLUMN_LIST

expr

Type_name

expr

Column_constraint

expr

Table_options

expr

Syntax

CREATE TABLE
  [IF NOT EXISTS]
  table_name
  (COLUMN_LIST)
  [with comment 'comment'];

Arguments

Argument Description Required? Additional information
table_name Valid table name Yes Naming standards
IF NOT EXISTS Optional argument that stops statement execution if a table of the same name already exists No  
COLUMN_LIST List of column names, data types and optional constraints. The list must include the _id column Yes * _id column
* Naming standards
* Data types
with comment Optional string literal that describes the table No  

Additional information

Naming standards

FeatureBase identifiers (including object names such as databases, tables and columns) start with a lower-case alphabetic character and can include:

  • lower-case alphabetic characters
  • numbers 0-9
  • dash - and underscore _ characters.

  • table names can be up to 230 characters in length

  • column names can be up to 64 characters in length

_id column

The table ID column (_id) is used as the table primary key and must uniquely represent a record in your table.

UI Type SQL data type Data source table unique key
Number id Positive integer
String string String key or a combination of columns used to create a unique key

CREATE TABLE examples

Further information