How about this?

CREATE TABLE `test`.`test` (
  `x` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  `y` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  `Z` INTEGER UNSIGNED NOT NULL DEFAULT 0,
  UNIQUE `Index_1`(`x`, `y`, `Z`)
)
ENGINE = InnoDB;
 
Tim

-----Original Message-----
From: Scott Purcell [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 01, 2006 9:07 AM
To: mysql@lists.mysql.com
Subject: constraining unique values across columns

I occasionally run into issues where I would like to ensure that the values
across two or three columns are not duplicated. At work we use Oracle, and I
see that they add constraints when creating the columns. I am running mysql
5.0 and was hoping someone could give me the simple explanation of how to
create constraints, and whether indexes' are needed for these or not.

 

I have tried reading the docs in this regard, but because I do not
understand the concept I am having trouble translating to the actual
creation of these.

 

Thanks,

Scott



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to