1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-05-28 13:01:26 +03:00

90 lines
6.4 KiB
Plaintext

DROP DATABASE IF EXISTS mcs38_db;
CREATE DATABASE mcs38_db;
USE mcs38_db;
CREATE TABLE t1
(
t1_tinyint TINYINT DEFAULT 0,
t1_int INT DEFAULT NULL,
t1_bigint BIGINT,
t1_double DOUBLE,
t1_float FLOAT,
t1_blob BLOB,
t1_text TEXT,
t1_char CHAR(1),
t1_varchar VARCHAR(255) DEFAULT 'hello world!',
t1_datetime DATETIME
)ENGINE=Columnstore;
INSERT INTO t1 VALUES();
INSERT INTO t1 (t1_bigint, t1_double, t1_float, t1_blob, t1_text, t1_char, t1_datetime) VALUES
(203685477580679, -3.797693231E+108, -7.402866E+18, repeat('a',20), repeat('a',25), 'a', '2020-10-10');
INSERT INTO t1 (t1_bigint, t1_double, t1_float, t1_blob, t1_text, t1_char, t1_datetime) VALUES
(203685477580680, -3.797693231E+108, -7.402866E+18, repeat('a',20), repeat('b',25), 'b', '1234-10-10');
INSERT INTO t1 (t1_bigint, t1_double, t1_float, t1_blob, t1_text, t1_char, t1_datetime) VALUES
(203685477580677, -3.797693231E+108, -7.402866E+18, repeat('a',20), repeat('b',25), 'c', '2020-10-11');
INSERT INTO t1 (t1_bigint, t1_double, t1_float, t1_blob, t1_text, t1_char, t1_datetime) VALUES
(203685477580678, -3.797693231E+108, -7.402866E+18, repeat('a',20), repeat('b',25), 'd', '2020-10-10');
INSERT INTO t1 (t1_bigint, t1_double, t1_float, t1_blob, t1_text, t1_char, t1_datetime) VALUES
(203685477580676, -3.797693231E+108, -7.402866E+18, repeat('a',20), repeat('b',25), 'e', '2020-10-13');
SELECT * FROM t1;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL 203685477580676 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb e hello world! 2020-10-13 00:00:00
0 NULL 203685477580677 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb c hello world! 2020-10-11 00:00:00
0 NULL 203685477580678 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb d hello world! 2020-10-10 00:00:00
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL 203685477580680 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb b hello world! 1234-10-10 00:00:00
0 NULL NULL NULL NULL NULL NULL NULL hello world! NULL
SELECT t1_int,t1_blob,t1_datetime FROM t1 LIMIT 2;
t1_int t1_blob t1_datetime
NULL NULL NULL
NULL aaaaaaaaaaaaaaaaaaaa 2020-10-10 00:00:00
SELECT * FROM t1 LIMIT 2;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL NULL NULL NULL NULL NULL NULL hello world! NULL
SELECT * FROM t1 LIMIT 10;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL 203685477580676 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb e hello world! 2020-10-13 00:00:00
0 NULL 203685477580677 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb c hello world! 2020-10-11 00:00:00
0 NULL 203685477580678 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb d hello world! 2020-10-10 00:00:00
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL 203685477580680 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb b hello world! 1234-10-10 00:00:00
0 NULL NULL NULL NULL NULL NULL NULL hello world! NULL
SELECT * FROM t1 ORDER BY t1_datetime LIMIT 5;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL 203685477580677 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb c hello world! 2020-10-11 00:00:00
0 NULL 203685477580678 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb d hello world! 2020-10-10 00:00:00
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL 203685477580680 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb b hello world! 1234-10-10 00:00:00
0 NULL NULL NULL NULL NULL NULL NULL hello world! NULL
INSERT INTO t1 SELECT * FROM t1;
SELECT MAX(t1_bigint) FROM t1 GROUP BY t1_text LIMIT 10;
MAX(t1_bigint)
203685477580679
203685477580680
NULL
SELECT * FROM t1 WHERE t1_text like '%a%' LIMIT 10;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
SELECT * FROM t1 ORDER BY t1_bigint ASC LIMIT 0,1;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL NULL NULL NULL NULL NULL NULL hello world! NULL
SELECT * FROM t1 ORDER BY t1_bigint ASC LIMIT 1,1;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL NULL NULL NULL NULL NULL NULL hello world! NULL
SELECT * FROM t1 ORDER BY t1_bigint DESC LIMIT 1,4;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
0 NULL 203685477580678 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb d hello world! 2020-10-10 00:00:00
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL 203685477580679 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaa a hello world! 2020-10-10 00:00:00
0 NULL 203685477580680 -3.797693231e108 -7.40287e18 aaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbb b hello world! 1234-10-10 00:00:00
SELECT * FROM t1 LIMIT 0;
t1_tinyint t1_int t1_bigint t1_double t1_float t1_blob t1_text t1_char t1_varchar t1_datetime
SELECT * FROM t1 LIMIT @;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@' at line 1
SELECT * FROM t1 LIMIT -1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1' at line 1
SELECT * FROM t1 LIMIT 'a';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''a'' at line 1
DROP DATABASE mcs38_db;