mariadb-create-table

Documents MariaDB-specific CREATE TABLE syntax, extensions, and behavioral differences from standard SQL.

28|115|Updated Jan 28, 2025
One-click install
npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-create-table-mariadb-corporation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mariadb-create-table
Source: https://github.com/mariadb-corporation/mariadb-docs/tree/main/agent-skills/granular/statements/mariadb-create-table
Command: npx skills add https://github.com/mariadb-corporation/mariadb-docs --skill mariadb-create-table-mariadb-corporation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Standard SQL CREATE TABLE knowledge does not cover MariaDB's extensions, and LLMs frequently generate non-idiomatic or subtly wrong statements — such as using utf8 instead of utf8mb4, DROP plus CREATE instead of atomic CREATE OR REPLACE, or expecting foreign keys to work on Aria tables. This Skill supplies the exact MariaDB-specific syntax and behavioral rules needed to write correct CREATE TABLE statements. ## Core Features & Use Cases - MariaDB Syntax Delta Reference: Covers CREATE OR REPLACE, atomic DDL semantics, PERIOD FOR temporal clauses, and WITH SYSTEM VERSIONING for system-versioned, application-time, and bitemporal tables. - Column and Index Extensions: Documents INVISIBLE and COMPRESSED columns, expression defaults, PERSISTENT/VIRTUAL generated columns, VECTOR(N) columns, and IGNORED/INVISIBLE index options. - Table Options Guide: Explains per-table encryption, PAGE_COMPRESSED versus ROW_FORMAT=COMPRESSED, Aria options like TRANSACTIONAL, and engine-specific behaviors. - Use Case: When asked to create a table with audit history and compressed storage, produce CREATE TABLE t (...) WITH SYSTEM VERSIONING, PAGE_COMPRESSED=1, CHARSET=utf8mb4 instead of manual audit columns and the legacy compressed row format. ## Quick Start Ask the AI to write a MariaDB CREATE TABLE statement for your use case, such as a system-versioned table with an invisible column and page compression, and it will apply the correct MariaDB-specific syntax.

Frequently Asked Questions about mariadb-create-table

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a table in MariaDB with system versioning?▼

Add WITH SYSTEM VERSIONING to the CREATE TABLE statement to automatically track row history. You can exclude specific columns with WITHOUT SYSTEM VERSIONING, and combine it with PERIOD FOR for bitemporal tables.

What is the difference between utf8 and utf8mb4 in MariaDB?▼

In MariaDB, utf8 is an alias for the legacy 3-byte utf8mb3 charset, which cannot store 4-byte characters like most emoji. Always use CHARSET=utf8mb4 in CREATE TABLE for full Unicode support.

Should I use CREATE OR REPLACE TABLE or DROP and CREATE in MariaDB?▼

CREATE OR REPLACE TABLE is the atomic equivalent of DROP TABLE IF EXISTS followed by CREATE TABLE, avoiding a window where the table is missing. It cannot be combined with IF NOT EXISTS and is crash-safe but not fully atomic.

Does MariaDB support invisible columns in CREATE TABLE?▼

Yes, MariaDB supports the INVISIBLE column attribute, which excludes the column from SELECT * while keeping it accessible via explicit SELECT. INSERT statements without a column list also skip invisible columns.

Why are foreign keys ignored on my MariaDB table?▼

Foreign keys are silently parsed and discarded on MyISAM and Aria tables because only InnoDB enforces them. Set ENGINE=InnoDB in your CREATE TABLE statement for foreign key constraints to work.

What is the difference between PAGE_COMPRESSED and ROW_FORMAT=COMPRESSED in MariaDB?▼

PAGE_COMPRESSED=1 is the modern InnoDB and Aria page-level compression supporting LZ4, zstd, and other algorithms. ROW_FORMAT=COMPRESSED is the older InnoDB zlib mechanism; prefer PAGE_COMPRESSED for new tables.