Use an index.
--------------
Jonah Klimack wrote:
>
> Hi
>
> I want to enforce unique records in one of my
> tables.
>
> The table goes like this:
>
> ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
> customerID INT UNSIGNED,
> categoryname VARCHAR(20)
>
> With customer ID pointing to a customers table.
>
> I suddenly realized that one customer could input
> the same "categoryname" twice, which would create
> a duplicate entry in the database. (if you ignore the
> primary key).
>
> Is there something in
> MySQL, or in my table design, that can force unique records?
> Or will I have to check this with my code everytime I
> update the database?
>
> Thanks very much for any help! Much appreciated.
>
> ---------------------------------------------------------------------
> 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
--
Justin Farnsworth
Eye Integrated Communications
321 South Evans - Suite 203
Greenville, NC 27858 | Tel: (252) 353-0722
---------------------------------------------------------------------
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