Skip navigation links

MySQL Forums :: Ruby :: Ruby, Rails and MySQL gem ― through scaffolding, versioning, rake db:create, db:migrate ― HOW to implement and preserve your schema with SQL


Advanced Search

How to use a primary key different from `id'?
Posted by: Quique _ ()
Date: May 28, 2010 04:08AM

Thank you very much for this informative article.

I have a question though:
what should I do if I don't want the primary key to be `id', but some other attribute?

Example:

CREATE TABLE products (
name varchar(100),
description text,
PRIMARY KEY (name)
) ENGINE=INNODB;

Thanks!

Options: ReplyQuote


Subject Written By Posted
Ruby, Rails and MySQL gem ― through scaffolding, versioning, rake db:create, db:migrate ― HOW to implement and preserve your schema with SQL mike montagne 03/23/2010 06:16PM
How to use a primary key different from `id'? Quique _ 05/28/2010 04:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.