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 3963598
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:14:04+00:00 2026-05-20T03:14:04+00:00

My being fairly new to SQL, I was wondering if I could use it

  • 0

My being fairly new to SQL, I was wondering if I could use it to solve one of the complexities in my database automatically.

That is, I’m tracking entries by day.
So, the columns we are concerned with are:

  • YYYY
  • MM
  • DD
  • XXX

where YYYY is year, MM is month, DD is day and XXX is a unique number given to each entry on a given day. In such a way is uniqueness ensured.
My question is if I can use SQL to automatically increment XXX (from 0) if I enter two records with the same YYYY, MM and DD.
If not, I could do a query and manually check (but this would be easier).

I suppose the other option would be to use the _id column (that is _id INTEGER PRIMARY KEY AUTOINCREMENT) which is guaranteed to be unique for every row. Would that just be a better solution?

I’m use the Android SQLite implementation (with Java)

Thanks!

  • 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-20T03:14:05+00:00Added an answer on May 20, 2026 at 3:14 am

    We really need more details to give a good answer, but it sounds like just using an auto incrementing id as the primary key is a cleaner solution. In general, storing a string combining the date with a counter appended to the end is a bad idea.

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

Sidebar

Related Questions

Being fairly new to JavaScript, I'm unable to discern when to use each of
Being relatively new to the .net game, I was wondering, has anyone had any
Being stuck with a legacy database schema that no longer reflects your data model
Being really new to wx, I'm wondering if there is an IDE (especially for
I have one object being the result of a database query, looking something like
Being new to test based development, this question has been bugging me. How much
Fairly new to jquery so I might be making a simple mistake but I
I have an image being edited and reloaded with a new query string appened
Being vaguely familiar with the Java world I was googling for a static analysis
Being a C# developer since version 1.0, F# has captured my free time for

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.