CREATE TYPE AS ENUM¶
Clause in a schema template definition to create an enum type.
Syntax¶
Parameters¶
enumName
The name of the
ENUM
typestringLiteral
A
STRING
representation of anENUM
value
Example¶
CREATE SCHEMA TEMPLATE TEMP
CREATE TYPE AS ENUM color ('blue', 'red', 'yellow')
CREATE TABLE dot(X INTEGER, Y INTEGER, C color, PRIMARY KEY(X, Y));
-- On a schema that uses the above schema template
INSERT INTO dot VALUES
(1, 1, 'blue'),
(1, 2, 'yellow'),
(2, 2, 'red'),
(3, 2, 'red');
SELECT * FROM dot;
SELECT * FROM dot WHERE C = 'red';