04-10-2010, 03:00 PM
(Modification du message : 04-10-2010, 03:04 PM par christouphe.)
il faudrait faire le test...2 sec
C'est le premier rencontré:
DROP TABLE IF EXISTS `matable`;
CREATE TABLE IF NOT EXISTS `matable` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`pseudo` varchar(20) NOT NULL,
`email` varchar(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `pseudo` (`pseudo`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `matable`
--
INSERT INTO `matable` (`id`, `pseudo`, `email`) VALUES
(1, 'toto', 'toto@toto.to');
puis:
INSERT INTO `matable` (`pseudo`, `email`) VALUES
('toto', 'toto@toto.to');
résultat:
#1062 - Duplicate entry 'toto' for key 'pseudo'
C'est le premier rencontré:
DROP TABLE IF EXISTS `matable`;
CREATE TABLE IF NOT EXISTS `matable` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`pseudo` varchar(20) NOT NULL,
`email` varchar(20) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `pseudo` (`pseudo`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `matable`
--
INSERT INTO `matable` (`id`, `pseudo`, `email`) VALUES
(1, 'toto', 'toto@toto.to');
puis:
INSERT INTO `matable` (`pseudo`, `email`) VALUES
('toto', 'toto@toto.to');
résultat:
#1062 - Duplicate entry 'toto' for key 'pseudo'