File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create sequence in mysql

 
krish bhadragiri
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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')
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic