Hi,
your enum canbe NULL and is not indexed. So you can insert values not in enum,
replaced by NULL.
a solution is to UNIQUE index the enum column, and insert a unique bad value in
it.
Any value not in enum can not then be inseted :
mysql create table enum_test(id int, name enum('test1','test2')
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
column are
those you want to appear in the tblJob.JobType column.
On Jun 25, 2005, at 10:28 AM, Chris Andrew wrote:
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
Another approach would be to use a view with a CHECK OPTION. This will
allow the view to behave exactly like a check constraint:
CREATE VIEW tblJob_view AS
SELECT JobId, CustomerId, JobType, Description,
QuotationDate, OrderDate
FROM tblJob
WHERE JobType IN ('DesignOnly
permit
any person or program to insert data directly via the table.
Rhino
- Original Message -
From: Partha Dutta [EMAIL PROTECTED]
To: 'Michael Kruckenberg' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: mysql@lists.mysql.com
Sent: Saturday, June 25, 2005 11:11 AM
Subject: RE: CHECK constraint
that the only entries in the JobType.Name column are
those you want to appear in the tblJob.JobType column.
On Jun 25, 2005, at 10:28 AM, Chris Andrew wrote:
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
Hi,
Use enum with a default type and let mysql do the check for you.
The problem with an enum is that if you insert a value that's not in
the enum, MySQL doesn't stop the insert, it leaves the column empty.
This doesn't enforce data integrity like I think Chris wanted.
mysql desc
Mysql 4.0.12 on win xp.
Question: is the check constraint supported?
Example:
create table temp (
c1 varchar (50) check (c1 like [EMAIL PROTECTED])
);
insert into temp values (whatever);
will succeed. Is my constraint wrong (say to check the
email address)? or this is just parsed without
At 20:10 -0800 3/13/04, Andrew Zhu wrote:
Mysql 4.0.12 on win xp.
Question: is the check constraint supported?
Example:
create table temp (
c1 varchar (50) check (c1 like [EMAIL PROTECTED])
);
insert into temp values (whatever);
will succeed. Is my constraint wrong (say to check the
email
select *From test;
+--+
| age |
+--+
| -1 |
+--+
1 row in set (0.01 sec)
How can I enforce the CHECK constraint ?
thanks
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
affected (0.00 sec)
mysql select *From test;
+--+
| age |
+--+
| -1 |
+--+
1 row in set (0.01 sec)
How can I enforce the CHECK constraint ?
MySQL doesn't support CHECK constraints:
http://www.mysql.com/doc/en/CREATE_TABLE.html
With regards,
Martijn Tonies
Database Workbench
Hi !!!
Is there a check constraint available in Mysql?
If there is one plase send the Syntax as well
Amit Lonkar
__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
Hi,
Any round about way of achieving CHECK CONSTRAINT
FEATURE in MySQL before inserting a data into
database?
REgards,
Ravi
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address
13 matches
Mail list logo