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

  • SEARCH
  • Home
  • 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

I am fairly new to JQuery. That being said I am trying to use
Being fairly new to Grails i was wondering what people use to consume a
After reading Jeff's blog post and being fairly new to GUI programming, I'm wondering
First let me state that, despite being a fairly new practitioner of TDD, I'm
Fairly new to Jquery here.... but one thing I have been told and being
Being fairly new to JavaScript, I'm unable to discern when to use each of
Being fairly new to programming, I am having trouble understanding exactly what Homebrew does...
I'm confused as to the difference. Being fairly new to .Net, I know I
Being new to SQLAlchemy, I was wondering at what time would Session() should be
I am still fairly new to SQL so I wanted to know if I

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.