I have the following database table. I am trying to figure out a way that I can structure this so that I can have a position for each player column. Because each user is going to have multiple players and there will be multiple users, I cannot figure out the best way to model my db table for efficiency.
CREATE TABLE `user_players` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`firstname` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`lastname` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player1` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player2` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player3` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player4` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player5` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player6` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
The only thing that I can think of is adding a player_position for ever player, so that it would look like this...
`player1` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player_position1` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player2` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`player_position2` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
Is there a better, more efficient way to do this?