Martin Thoma wrote:
> Hello !
>
> I'm a database-newbee. What I need is a column that makes the record
> unique. The content should be generated autoamtically and it should be
> able to get a lot of records (BIGINT would be nice). But I don't know if
> I should use PRIMERY KEY, KEY, INDEX or UNIQUE. Perhaps some could tell
> me the difference and what would be best for my purpose.
>
> Thanks a lot !
>
> Martin
>
You shold have atleast one column (or combination) that is unique to each
row in your table, this would be the PRIMARY KEY.
If you need the database to enforce the uniqueness of other columns (or combinations)
you would use a UNIQUE KEY.
KEY and INDEX are synonyms.
That work?
If you want it generated automaticaly what you want is an auto_increment column
something like
create table blah (id bigint unsigned not null auto_increment, .... rest of table
columns)
would hold a VERY large number that would increase for each entry.
probably an 'int unsigned' is big enough for most things.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php