Documentation — Commands reference
Creates a table in the dictionary. Nothing is stored yet: the data broker tables appear when you run deploy table.
create table TABLE_NAME ( COLUMN TYPE [, COLUMN TYPE ...] );
create table TABLE_NAME empty;
create table TABLE_NAME wide;
TABLE_NAME and the column names are lower case letters, digits and underscores, starting with a letter. A reserved word is refused. 31 and 63 characters at most.not null, default, unsigned, comment...). Up to 1024 columns in one statement.empty creates a table without columns: add them with alter table ... add column. Use it when the definition is too long for the dictionary.wide creates an empty table that will be a wide table whatever its final number of columns (see Wide or narrow tables).create table exemple1 ( id int primary key not null, col2 varchar(25) not null, col3 varchar(4096) null );
A table must have a datacenter and a hash key before it can be deployed:
alter table exemple1 set datacenter 'DC1';
alter table exemple1 set hash key id;
deploy table exemple1;
null and not null always apply.primary key or unique constraint only applies inside one segment: the same value may exist in two partitions unless the column is the hash key. You cannot declare a multi-column primary key or unique key in create table; the statement is accepted but the deployment fails.create table T wide; and add the columns with alter table, in batches.