design - MySQL: Racer number for different compettitors -


i have table in mysql (among other) columns: id - int auto_increment pk competitionid - fk competition

there more (ie registrationdate etc...), 2 important want/need add column racernumber requirements:

racernumber autoincremental, each competition restart so... this:

id    competitionid    racernumber 1     1                1 2     1                2 3     1                3 4     2                1 5     2                2 6     3                1 7     3                2 8     3                3 9     3                4 

but just... well, running in circles. trying avoid solution using algoritms etc, there way achieve design? know, if dropped id column solved using composite pk (competitionid,racernumber), given how need work racer data etc, lead quite lot of coding added. :(

tables:

table user - table contains persons - name, gender, etc table competition - table of competition - when, where, table racer contains link between user-competition, saying user has entered     competition b. (alternative name registration ?) 


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -