ClickHouse/tests/queries/0_stateless/02893_array_enum_has_hasAny.sql
2024-08-18 03:25:25 +02:00

17 lines
692 B
SQL

DROP TABLE IF EXISTS v;
DROP TABLE IF EXISTS v2;
CREATE TABLE IF NOT EXISTS v (value Array(Enum('foo' = 1, 'bar' = 2))) ENGINE = Memory;
INSERT INTO v VALUES (['foo', 'bar']), (['foo']), (['bar']);
SELECT * FROM v WHERE has(value, 'foo') ORDER BY value;
SELECT * FROM v WHERE hasAny(value, ['bar']) ORDER BY value;
SELECT * FROM v WHERE has(value, 'x') ORDER BY value;
CREATE TABLE IF NOT EXISTS v2 (value Array(Array(Nullable(Enum('foo' = 1, 'bar' = 2))))) ENGINE = Memory;
INSERT INTO v2 VALUES ([['foo', 'bar']]), ([['foo']]), ([['bar']]);
SELECT * FROM v2 WHERE has(value, ['foo']) ORDER BY value;
SELECT * FROM v2 WHERE has(value, [NULL]) ORDER BY value;
DROP TABLE v;
DROP TABLE v2;