PostgreSQL to MySQL

Hi I am trying to create an application in Java using MySQL. Previously I have created a couple of small apps with PostgreSQL.

My problem is, what is the equivalent in MySQL for this statement:

create sequence dbname.entity_id_sequence;

and then the corresponding statement to get the next id previously in PostgreSQL it would be:

DEFAULT nextval('dbname.entity_id_sequence')

what would it be now?

[436 byte] By [boom_zapa] at [2007-10-2 20:10:21]
# 1

If you would read the fine manuals, here:

http://dev.mysql.com/doc/

you would quickly find that MySQL does not support sequences.

You can either switch to using auto-increment on a column, or simulate a sequence with a table and the LAST_INSERT_ID() function as described in the documentation, here;

http://dev.mysql.com/doc/refman/5.1/en/information-functions.html

StuDerbya at 2007-7-13 22:50:56 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...