?
Solved

MySQL for race results

Posted on 2015-01-31
3
Medium Priority
?
398 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
  • 2
3 Comments
 
LVL 81

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 81

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

862 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