summaryrefslogtreecommitdiff
path: root/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result
blob: ab1cc56cdc55934b911e98d2d7b4f72a666db0cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
DROP TABLE IF EXISTS diaries;
CREATE TABLE diaries (
id INT PRIMARY KEY AUTO_INCREMENT,
date TIMESTAMP NOT NULL,
title VARCHAR(100) NOT NULL,
content TEXT NOT NULL,
UNIQUE INDEX (date, title)
) DEFAULT CHARSET=UTF8 COMMENT='ENGINE "MyISAM"';
SHOW CREATE TABLE diaries;
Table	Create Table
diaries	CREATE TABLE `diaries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `title` varchar(100) NOT NULL,
  `content` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `date` (`date`,`title`)
) ENGINE=Mroonga DEFAULT CHARSET=utf8mb3 COMMENT='ENGINE "MyISAM"'
INSERT INTO diaries (date, title, content)
VALUES ("2012-03-04", "cloudy day", "Today is cloudy day...");
INSERT INTO diaries (date, title, content)
VALUES ("2012-03-04", "shopping", "I buy a new shirt.");
INSERT INTO diaries (date, title, content)
VALUES ("2012-03-05", "rainy day", "Today is rainy day...");
SELECT * FROM diaries;
id	date	title	content
1	2012-03-04 00:00:00	cloudy day	Today is cloudy day...
2	2012-03-04 00:00:00	shopping	I buy a new shirt.
3	2012-03-05 00:00:00	rainy day	Today is rainy day...
INSERT INTO diaries (date, title, content)
VALUES ("2012-03-04", "shopping", "I buy new shoes.")
ON DUPLICATE KEY UPDATE date = "2012-03-03",
content = "I buy a new hat.";
SELECT * FROM diaries;
id	date	title	content
1	2012-03-04 00:00:00	cloudy day	Today is cloudy day...
2	2012-03-03 00:00:00	shopping	I buy a new hat.
3	2012-03-05 00:00:00	rainy day	Today is rainy day...
DROP TABLE diaries;