Hi there, I've a case where I need to store twitter username, email, and some other field to be unique. However, I can only set twitter username later. Not on registration process. How can I handle this in SQL?
Here's my current SQL structure:
CREATE TABLE `kios_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(32) NOT NULL,
`password` varchar(60) NOT NULL,
`email` varchar(100) NOT NULL,
`no_hp` varchar(15) NOT NULL,
`twitter_oauth_token` varchar(60) NOT NULL,
`twitter_oauth_token_secret` varchar(60) NOT NULL,
`twitter_username` varchar(32) NULL,
`verify_level` enum('just_reg','hp_ok','all_ok') NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `no_hp` (`no_hp`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `twitter_username` (`twitter_username`)
) ENGINE=MyISAM
With this kind of structure, I can't set twitter_username
to empty. Can you suggest me the best table structure?