Available only in unstable builds.
CREATE TABLE creates a non-streaming, in-memory data source.
Tables store non-streaming data that is inserted via INSERT statements.
When to create a table
You might want to create a table when…
- Manually inserting rows of data into Materialize.
- Testing Materialize’s features without setting up a data stream.
|table_name||A name for the table.|
|col_name||The name of the column to be created in the table.|
|col_type||The data type of the column indicated by col_name.|
|NOT NULL||Do not allow the column to contain NULL values. Columns without this constraint can contain NULL values.|
Tables do not persist any data that is inserted. This means that restarting a Materialize instance will lose any data that was previously stored in a table.
Additionally, tables do not currently support:
- Primary keys
- Unique constraints
- Check constraints
- Default column values
- Insert statements that use anything other than a
VALUES clause, such as
INSERT INTO ... SELECT
UPDATE ... and
Creating a table
We can create a table
t with the following statement:
CREATE TABLE t (a int, b text NOT NULL);
Once a table is created, we can inspect the table with various
SHOW TABLES; TABLES ------ t SHOW COLUMNS IN t; Field Nullable Type ------------------------- a YES int4 b NO text