CREATE TABLE IF NOT EXISTS `tbl_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) COLLATE latin1_general_ci NOT NULL,
`passd` varchar(50) COLLATE latin1_general_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;
我们有usermane
as unique
,我们可以用它作为主键,那么保持 id 作为主键有什么好处呢?
谢谢