I am building the database for a web application where users may submit data. Each datum is unique, and more than one user can submit the same datum.
It is important, from the application's standpoint, to know the order in which users submitted the datum.
I have made a table exclusively for this purpose. It has the following fields:
SubmissionID
UserID
SubmissionOrder
... # and other non-important ones
My question is, which attributes should I make primary keys?
SubmissionID
and UserID
would allow for duplicate SubmissionOrder
s for a (SubmissionID, UserID)
pair.
SubmissionID
and SubmissionOrder
would allow the same user to submit the same thing twice.
UserID
and SubmissionOrder
... would limit the user considerably in terms of what he can submit :P
All three would allow duplicate SubmissionOrder
s for different UserID
s.
Is there another solution which I am not pondering?
Is this problem better solved at the application level? With triggers?
Thank you for your time!
PS: Some technical details which I doubt you'll find useful:
- The application is written in PHP
- The database runs on sqlite3