--disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1(c1 CHAR(10) NOT NULL, c2 CHAR(10) NULL, c3 CHAR(10) NULL, PRIMARY KEY (c1), UNIQUE (c2)); INSERT INTO t1 (c1,c2,c3) VALUES('a','e','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('b','d','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('d','b','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('e','a','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; INSERT INTO t1 (c1,c2,c3) VALUES('a','a','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; --sorted_result SELECT * FROM t1; DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(10) NOT NULL, c2 VARCHAR(10) NULL, c3 VARCHAR(10) NULL, PRIMARY KEY (c1), UNIQUE (c2)); INSERT INTO t1 (c1,c2,c3) VALUES('a','e','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('b','d','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('d','b','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('e','a','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; INSERT INTO t1 (c1,c2,c3) VALUES('a','a','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; --sorted_result SELECT * FROM t1; DROP TABLE t1; CREATE TABLE t1(c1 BINARY(10) NOT NULL, c2 BINARY(10) NULL, c3 BINARY(10) NULL, PRIMARY KEY (c1), UNIQUE (c2)); INSERT INTO t1 (c1,c2,c3) VALUES('a','e','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('b','d','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('d','b','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('e','a','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; INSERT INTO t1 (c1,c2,c3) VALUES('a','a','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; --sorted_result SELECT * FROM t1; DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(10) NOT NULL, c2 VARBINARY(10) NULL, c3 VARBINARY(10) NULL, PRIMARY KEY (c1), UNIQUE (c2)); INSERT INTO t1 (c1,c2,c3) VALUES('a','e','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('b','d','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('d','b','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('e','a','abc'); INSERT INTO t1 (c1,c2,c3) VALUES('c','c','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; INSERT INTO t1 (c1,c2,c3) VALUES('a','a','abc') ON DUPLICATE KEY UPDATE c3='abcdefg'; --sorted_result SELECT * FROM t1; DROP TABLE t1;