Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating primry keys

 
Piradharsan Navaratnam
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Friend How can I create unique primary keys in java or in mysql.

Please read this...........

There are lot of speed posts(type of mail/letter) are accepted in our postoffices. I need to uniquely identify them. I thought to generate a unique id like this.

Say its 04thJune07 then
the ids will propogate like 040607(a unique post office id - 5 digits)(auto increment letter id)

For example 040607907361
040607 is the date, 90736 is the post office code (there are unique code for every post offices), 1 is the autoincrement no.

Can any body help me?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on Servlets.

This post has been moved to a more appropriate forum.
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a Google search command that searches the official mysql site for autoincrement within a CREATE TABLE SQL command:

create table autoincrement site:www.mysql.com

Kaydell
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic