Dear List,

My system is RedHat EL3 and MySQL 5.0.7-beta.

I wanted to implement a check constraint (below), but after some testing
and googling, it seems I can't do this with MySQL. I've read suggestions
that check(s) should be done using triggers. Is a trigger a preferred
method of achieving the following:

CREATE TABLE tblJob (
  JobId                 SMALLINT UNSIGNED NOT NULL,
  CustomerId            SMALLINT UNSIGNED NOT NULL,
  JobType               VARCHAR(20) NOT NULL DEFAULT 'DesignInstall',
  Description           VARCHAR(100) NOT NULL,
  QuotationDate         DATE NOT NULL,
  OrderDate             DATE,
  CHECK (JobType IN ('DesignOnly', 'DesignInstall', 'InstallOnly')),
  PRIMARY KEY          (JobId, CustomerId)
) TYPE=InnoDB;

Regards,
Chris



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

Reply via email to