?
Solved

MySQL for race results

Posted on 2015-01-31
3
Medium Priority
?
378 Views
Last Modified: 2015-02-06
I want to create a MySQL database to hold the results of a race that will take place annually.

The details I want in the table are:-
surname, firstname, racenumber, finishtime, year

Each year, runners will be issued a unique race (bib) number. However, the same set of numbers will be used each year.

What is the best way of keeping the racenumber field unique for each year? (i.e. racenumber must be a unique number between 1 and 200 for year 2015, and then again must be a unique number between 1 and 200 for year 2016 etc)
0
Comment
Question by:Chris Millard
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 79

Assisted Solution

by:arnold
arnold earned 2000 total points
ID: 40581431
What is the app you use to access the mysql, that is where you would randomize the assignment.
Presumably you a second table that has
Runnerid from the main runner info table
Year of the run
Runner number
All three will be added as a unique index. This will insure that there will not be two runner ers in a year with the same number enforced by the database.
Runner table
Year and number table.

Alternatively, you can assign a number to the individual in the order they are signed in.
That will insure uniqueness as well. First person to check in/sign in or be checked in/signed in will be 1 and the last will be 200
You could alternate the order year to year if you want, start from one and increment or start from 200 and decrement by changing the increment for the table.
0
 
LVL 79

Accepted Solution

by:
arnold earned 2000 total points
ID: 40581432
The runner, year, race number table can include the results for the race, if you need to keep track of the time in various locations, another table could do that.
0
 
LVL 17

Author Closing Comment

by:Chris Millard
ID: 40593363
Thanks for the ideas - I haven't made a decision yet, as I have just over a year in order to finalise everything.
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question