aspose file tools*
The moose likes JDBC and the fly likes how to create sequence in mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to create sequence in mysql" Watch "how to create sequence in mysql" New topic
Author

how to create sequence in mysql

krish bhadragiri
Greenhorn

Joined: Apr 17, 2007
Posts: 13
please send me the syntax for creating the sequence in mysql and how that sequence be linked to different fields of different tables.
Jeff Ash
Greenhorn

Joined: Apr 07, 2007
Posts: 11
MySQL doesn't use sequences. You will use AUTO_INCREMENT fields. The following CREATE TABLE statement shows an example:

CREATE TABLE person (
PERSON_ID int(10) NOT NULL auto_increment,
FIRST_NAME varchar(50) default NULL,
MIDDLE_NAME varchar(50) default NULL,
LAST_NAME varchar(50) default NULL,
PRIMARY KEY (PERSON_ID)
)

Then when you insert into the table just don't specify a value for the PERSON_ID:

INSERT INTO person (first_name, last_name) VALUES ('John', 'Doe')


Jeff Ash<br /><a href="http://www.excellentiasoftware.com" target="_blank" rel="nofollow">Excellentia Software</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to create sequence in mysql