1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-06 08:21:01 +03:00

29 lines
857 B
Plaintext

#
# Test IF function
# Author: Bharath, bharath.bokka@mariadb.com
#
-- source ../include/have_columnstore.inc
--disable_warnings
DROP DATABASE IF EXISTS mcs176_db;
--enable_warnings
CREATE DATABASE mcs176_db;
USE mcs176_db;
SET default_storage_engine=Columnstore;
CREATE TABLE t1 (a CHAR(1), b INT, c DATETIME, d DOUBLE);
INSERT INTO t1 VALUES ('', NULL, '0-0-0', NULL),('a', 12, '1212-12-12', 1.19691E+100),('b', 13, '1313-3-13 13:13:13', 2.1961E+18),('c', 14, '1414-4-14', 0.16191),('d', 15, '2015-5-15 15:15:15', 1.971917);
SHOW CREATE TABLE t1;
SELECT IF(10<20, 1, 2);
SELECT IF(STRCMP("hello","hi") = 0, "YES", "NO");
SELECT a, IF(a='b', 10, 20) AS result FROM t1;
SELECT b, IF(b<=13, 'Less than or equal to 13', 'Greater than 13') AS result FROM t1;
SELECT c, IF(c>0, 'date', 'zero date') AS result FROM t1;
# Clean UP
DROP DATABASE mcs176_db;