Need some tips on my SQL script?

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-04-27T08:28:54Z Indexed on 2010/04/27 8:33 UTC
Read the original article Hit count: 374

Filed under:
|
|

Hi I plan to create a tale to store the race result like this,

Place    RaceNumber       Gender      Name              Result    
12       0112              Male     Mike Lee            1:32:40 
16       0117              Female   Rose Marry           2:20:40 

I confused at the items type definiation.

Q1.I am not sure the result can be set to varchar(32) or other type?

Q2. and for racenumber, between int(11) and varchar(11), which one is better?

Q3. Can I use `UNIQUE KEY` like my way?

Q4. Do I need split name to firstName and lastName in my DB table?

DROP TABLE IF EXISTS `race_result`;
CREATE TABLE IF NOT EXISTS `race_result` (
  `id` int(11) NOT NULL auto_increment,
  `racenumber` int(11) NOT NULL,
  `gender` enum('male','female') NOT NULL,
  `name` varchar(16) NOT NULL,
  `result` varchar(32) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `racenumber` (`racenumber`,`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 AUTO_INCREMENT=3;

© Stack Overflow or respective owner

Related posts about sql

Related posts about table