Ok, I will ask the obvious question: why do you refuse to use auto_increment? If this was Oracle or Postgresql, of course we would use sequences, but that isn't available in MySQL. Personally, I would not go to Rome to order the sushi.
However, there is the function uuid() which can be used ie. SELECT uuid(); and produces a guaranteed unique 36 character sitrng, but this might not be very efficient in joins as your dataset grows. - michael dykman On Tue, Apr 28, 2009 at 12:59 AM, yuan edit <edit.y...@gmail.com> wrote: > I have a shopping cart table like this: > > CREATE TABLE shopping_cart( > id VARCHAR(20) NOT NULL, > product_id INT NOT NULL, > product_quantity INT NOT NULL, > ... > ... > user_id INT NOT NULL, > current_timestamp TIMESTAMP, > primary key (id) > ); > > I will not use auto_increment > > Is there other way to generate unique primary key in MySQL? > > Thank you > -- - michael dykman - mdyk...@gmail.com - All models are wrong. Some models are useful. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org