Community journal

The latest from the MySQL community

Ideas, releases, practical guides, and perspectives from the people building with MySQL.

Follow the feed
Showing entries 1 to 1 of 1 « Previous | Next »
Displaying posts with tag: auto_increment (reset)
AUTO_INCREMENT: Différences MyISAM - InnoDB

La clause, AUTO_INCREMENT, permet à MySQL de générer un entier unique pour tout nouvel enregistrement d’une table. Cette clause ne peut se mettre que sur les champs de type entier, indexé et non nul. Elle est donc souvent utilisée comme clé primaire.

Cependant, sont comportement n’est pas tout à fait identique sur une table MyISAM et sur une table InnoDB.

mysql> CREATE TABLE table_myisam (id INT AUTO_INCREMENT PRIMARY KEY) engine=MyISAM;

mysql> SHOW CREATE TABLE table_myisam;

CREATE TABLE `table_myisam` (

`id` int(11) NOT NULL AUTO_INCREMENT,

PRIMARY KEY (`id`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1

mysql> INSERT INTO table_myisam (id) VALUES (NULL),(NULL),(NULL),(100);

Query OK, 4 rows affected (0.02 sec)

Records: 4 Duplicates: 0 Warnings: 0

mysql> SELECT …

[Lire plus]