Skip to content

Instantly share code, notes, and snippets.

@k12u
Created August 10, 2011 05:02
Show Gist options
  • Save k12u/1136164 to your computer and use it in GitHub Desktop.
Save k12u/1136164 to your computer and use it in GitHub Desktop.
mysql: 意外な挙動
mysql> show create table m\G
*************************** 1. row ***************************
Table: m
Create Table: CREATE TABLE `m` (
`id` int(11) NOT NULL,
`status` varchar(64) DEFAULT NULL,
`value` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> select * from m;
+----+--------+-------+
| id | status | value |
+----+--------+-------+
| 1 | new | 111 |
| 2 | new | 111 |
| 3 | new | 111 |
| 4 | new | 111 |
| 5 | new | 111 |
| 6 | new | 111 |
| 12 | new | 111 |
| 7 | new | 111 |
| 8 | new | 111 |
| 9 | new | 111 |
| 10 | new | 111 |
| 11 | new | 111 |
+----+--------+-------+
12 rows in set (0.00 sec)
mysql> delete from m where id = 12;
Query OK, 1 row affected (0.22 sec)
mysql> insert into m values(12, 'new', 111),(13, 'new', 111),(14, 'new', 111),(15, 'new', 111),(16, 'new', 111),(17, 'new', 111),(18, 'new', 111),(19, 'new', 111),(20, 'new', 111);
Query OK, 9 rows affected (0.00 sec)
Records: 9 Duplicates: 0 Warnings: 0
mysql> select * from m;
+----+--------+-------+
| id | status | value |
+----+--------+-------+
| 1 | new | 111 |
| 2 | new | 111 |
| 3 | new | 111 |
| 4 | new | 111 |
| 5 | new | 111 |
| 6 | new | 111 |
| 12 | new | 111 |
| 7 | new | 111 |
| 8 | new | 111 |
| 9 | new | 111 |
| 10 | new | 111 |
| 11 | new | 111 |
| 13 | new | 111 |
| 14 | new | 111 |
| 15 | new | 111 |
| 16 | new | 111 |
| 17 | new | 111 |
| 18 | new | 111 |
| 19 | new | 111 |
| 20 | new | 111 |
+----+--------+-------+
20 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment