Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6683137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:47:10+00:00 2026-05-26T04:47:10+00:00

I am building the database for a web application where users may submit data.

  • 0

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 SubmissionOrders 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 SubmissionOrders for different UserIDs.

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:47:11+00:00Added an answer on May 26, 2026 at 4:47 am

    The order in which things happen is just a little fuzzy on most SQL platforms. As far as I know, no SQL platform guarantees both these two requirements.

    • There must be no ties.
    • Earlier submissions must always look like they’re earlier than later submissions.

    With a timestamp column, earlier submissions always look like they’re earlier than later submissions. But it’s easily possible to have two “submissions” with the same timestamp value, no matter how fine the resolution of your dbms’s timestamp.

    With a serial number (or autoincrementing number), there will be no ties. But SQL platforms don’t guarantee that a row having serial number 2 committed before a row having serial number 3. That means that, if you record both a serial number and a timestamp, you’re liable to find pairs of rows where the row that has the lower serial number also has the later timestamp.

    But SQLite isn’t quite SQL, so it might be an exception to this general rule.

    In SQLite, any process that writes to the database locks the whole database. I think that locking the database means you can rely on rowid() to be temporally increasing.

    So I think you’re looking at a primary key of {SubmissionID, UserID}, where rowid() determines the submission order. But I could be wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a web application that uses the database for Users, Security/roles, and
I'm building an application in Java to retrieve data from MySQL database. After executing
I am building a web application that will essentially allow authenticated users access to
I am building a web application that will let users follow discussion threads, in
I am building a web application where users can enter events, including event title
DTO I'm building a Web application I would like to scale to many users.
I'm building a web-based productivity application that has to deal with modest user concurrency,
I'm building an web application that I want users to have specific permissions to
I'm building a web application that uses Oracle Database 10g as the database backend.
I'm building a web application that will have access to PeopleSoft's database via jdbc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.