CREATE TABLE with MariaDB Xpand
This page is part of MariaDB's Documentation.
The parent of this page is: Table DDL for MariaDB Xpand
Topics on this page:
Overview
MariaDB Xpand supports the CREATE TABLE statement to create tables:
Xpand accepts table options in
CREATE TABLEstatements to define table characteristics
Compatibility
MariaDB Xpand 5.3
MariaDB Xpand 6.0
MariaDB Xpand 6.1
CREATE TABLE
To create a table with MariaDB Xpand, use the CREATE TABLE statement:
CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) REPLICAS=3;
Special Cases
Xpand accepts the
CHECKconstraint syntax inCREATE TABLE, but no constraint checking is performedXpand allows a default
ENUMvalue to be specified using the position:CREATE TABLE CountryLanguage (id INT, IsOfficial ENUM('T','F') NOT NULL default 1);
Xpand allows a default
ENUMvalue to be specified that is not in the list of possible valuesCREATE TABLE Sunny (Pig ENUM('little', 'big') DEFAULT 'pink');
Xpand does not trim trailing whitespace in
ENUMvaluesXpand does not raise an error if a
NOT NULLcolumn specifiesNULLas the default value, but the column is treated asNOT NULLXpand does not raise an error if the length for
DECIMALexceeds the maximum precision and will silently truncate, even ifsql_mode=STRICT_TRANS_TABLESis enabledXpand does not raise an error when the default value for an
INTcolumn is set to a quoted string, but inserts with the default value will be cast to0Xpand does not support the
%wildcard in database names
