ALTER TABLE tblname ADD UNIQUE (column1, column2);

The index will automatically be used if you use it in your WHERE clause in
that order. If you want to do fulltext searching on those columns, repeat
the query with FULLTEXT in place of UNIQUE.

> Hello,
>
> I'm trying to create a table with columns A, B, C, D such that values in
> columns A and B are not unique but if you consider them as a paired tuple,
> then for every row, <value in col A, value in col B> is
> unique. Furthermore, I'd like to create a index to use for searching
> through the database using this unique paired tuple.
>
> Does anyone know how to do this without actually merging columns A and B
> together?
>
> Thanks.


---------------------------------------------------------------------
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

Reply via email to