# Copyright(C) 2013 Kentoku SHIBA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1335  USA

--source ../../include/mroonga/have_mroonga.inc

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (
  id INT PRIMARY KEY AUTO_INCREMENT,
  c1 VARCHAR(10),
  c2 VARCHAR(10),
  KEY idx1(c1, c2)
) DEFAULT CHARSET UTF8;
SHOW CREATE TABLE t1;

INSERT INTO t1 (c1, c2) VALUES
  ('1999', '12'),
  ('2000', '11'),
  ('2001', '10'),
  ('2002', '09'),
  ('2003', '08'),
  ('2004', '07'),
  ('2005', '06'),
  ('2006', '05'),
  ('2007', '04'),
  ('2008', '03'),
  ('2009', '02'),
  ('2010', '01');

SELECT * FROM t1 WHERE c1 > '2005';
SELECT * FROM t1 WHERE c1 >= '2005';
SELECT * FROM t1 WHERE c1 = '2005';
SELECT * FROM t1 WHERE c1 <= '2005';
SELECT * FROM t1 WHERE c1 < '2005';

DROP TABLE t1;

--source ../../include/mroonga/have_mroonga_deinit.inc
