1 SELECT strftime('%s','now');
2 CREATE TABLE test (x INT, `key` VARBINARY(200));
3 SELECT * FROM test WHERE x IS NOT NULL;
4 CREATE INDEX `key` ON test(`key`(20));
5 SELECT avg(x) FROM test;
6 SELECT count(*) FROM test;
7 SELECT x FROM test WHERE ? >= `key` ORDER BY `key` DESC LIMIT 1;
8 SELECT x FROM test WHERE `key` < ?;
10 CREATE TABLE appointments (alert_at DATETIME);
11 INSERT INTO `appointments` (
14 NOW() + INTERVAL @delay SECOND
16 SELECT SUM(CASE WHEN x > 10 THEN 1 ELSE 0 END) FROM test;
18 CREATE TABLE issue14 (x integer);
19 INSERT INTO issue14 (x) VALUES (@x);
20 INSERT INTO issue14 SET x = @x;
21 INSERT INTO issue14 (x) SELECT @x;
23 INSERT INTO test VALUES (20, 'twenty') ON DUPLICATE KEY UPDATE x = x + ?;
24 INSERT INTO test VALUES (20, 'twenty') ON DUPLICATE KEY UPDATE x = VALUES(x) + ?;
25 INSERT INTO test VALUES (20, $$twenty$$);
26 INSERT INTO test VALUES (200,
33 RETURN ($1 ~ $q$[\t\r\n\v\\]$q$);
37 INSERT INTO `test` (`x`, `key`) VALUES
42 INSERT INTO test VALUES
48 SELECT count(*) > 0 FROM test;
49 SELECT count(*) * avg(x) FROM test;
52 INSERT INTO test VALUES
57 INSERT INTO `appointments` ( `alert_at`) VALUES (@alert);
58 INSERT INTO `appointments` ( `alert_at`) VALUES (FROM_UNIXTIME(@alert));
61 SELECT COUNT(x) FROM test;
64 SELECT COUNT(DISTINCT x), SUM(DISTINCT x) FROM test;
67 SELECT 0 <=> 0, 0 <=> null, null <=> 0, null <=> null;
70 SELECT 0 is 0, 0 is null, null is 0, null is null;
73 SELECT 42 is not distinct from null, 42 is distinct from null;
75 CREATE TABLE workareas (work_id int autoincrement, about text, k int) unique key (k);
78 and not exists (select 1 from workareas where work_id = test.x);
80 create table issue63 ( x text, y text );
82 select * from issue63 where x like 'hello%' or y like 'world%';
85 INSERT INTO `workareas` (`about`,`k`) VALUES (NULLIF(@about, ''),@k)
86 ON DUPLICATE KEY UPDATE
87 `work_id` = LAST_INSERT_ID(`work_id`);
90 SELECT `DATE`(CURRENT_TIMESTAMP);
91 SELECT DATE(CURRENT_TIMESTAMP);
94 `word` text COLLATE utf8_bin NOT NULL,
95 `amount` int(10) unsigned DEFAULT '0',
96 KEY `amount` (`amount`),
97 KEY `word` (`word`(10))
98 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
101 select x, count(*) nr from test group by x having nr > 1;
104 select x <> 0 AS y from test;
106 -- @select_alias_change_type
107 select x <> 0 AS x from test;
109 -- @create_oauth_tokens
110 CREATE TABLE IF NOT EXISTS `oauth_tokens` (
111 `id` INTEGER UNSIGNED PRIMARY KEY AUTO_INCREMENT,
112 `unique_value_google_drive` BINARY(16) AS (
113 CASE WHEN `client_name` = "google-drive" THEN
114 UNHEX(MD5(CONCAT_WS("|", `creator_user_id`, `email`)))