mysql - Need some tips on create table -


i plan create table store race result this:

place    racenumber       gender      name              result     12       0112              male     mike lee            1:32:40  16       0117              female   rose mary           2:20:40  

i confused @ items type definitions.

  1. i not sure result can set varchar(32) or other type?

  2. and racenumber, between int(11) , varchar(11), 1 better?

  3. can i use unique key way?

  4. do need split name firstname , lastname in db table?

drop table if exists `race_result`; create table if not exists `race_result` (   `id` int(11) not null auto_increment,   `place` int(11) not null,   `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; 

some advice/opinions regarding datatypes.

result - time, may want calculations on time, therefore should store time type.

racenumber - reference, whilst number, performing no calculations on number. therefore should store varchar rather int. avoid confusion usage , avoid accidently manipulation of number.

name - @ length of string allow name. careful limiting value much. 16 characters may small names in future.

place - required storage? can calculate place of runner based on result alone? however, should keep primary key table.


Comments

Popular posts from this blog

Delphi Wmi Query on a Remote Machine -