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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:54:07+00:00 2026-05-24T11:54:07+00:00

I am making a SQLite database with Java interface where the user can input

  • 0

I am making a SQLite database with Java interface where the user can input information for different dates. Basically its like a diary. But I am having trouble constructing a table for the database.
I have fields called year (eg 2011), month (from 1 to 12), dayofmonth (from 1 to 31) and other fields relating to user input. But none of these are any good for a primary field. I thought of concatenating yearmonthdayofmonth so January 11 2011 is 20111101 (making sure values less than 10 have a zero in front, so it isnt the same as November 1st 2011, for example). But this seems clumsy, even if it returns unique numbers.
Is there a beter way you can recommend?

  • 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-24T11:54:08+00:00Added an answer on May 24, 2026 at 11:54 am

    Consider using a simple auto-incrementing integer as the primary key. Then you can enforce uniqueness with a unique index, like;

    create unique index UX_YourTable_Date on YourTable(yearCol, monthCol, dayCol)
    

    This keeps the primary key small, avoids a computed or composite key, but still ensures correctness.

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

Sidebar

Related Questions

I'm making a dictionary database in SQLite and need some tips. My SQL is
I am working on making a new SQLite database. Obviously for a number of
I need to use SQLite database file as a file for storing information, and
I'm making a Java app that receives some names from SQLite and puts them
I am making the decision for an embededded database in an upcoming Java servlet
I've been using SQLite in my Java and C# applications, making use of the
I am having trouble with the sqlite database with an android program. I'm making
I have a rails application, running in development mode ( with a sqlite database
I have a database table like this: wagetable name lowhours highhours wage Default 0
I'm making dictionary, it have over 50000 rows. Now, I'm using sqlite for 30000

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.