MySQL CHECK约束替代 [英] MySQL CHECK constraint alternative

查看:204
本文介绍了MySQL CHECK约束替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据MySQL手册 CHECK 子句被解析,但被所有存储引擎忽略。所以我知道简单的解决方案是出了问题,但是有另一个可行的方法来达到相同的结果?也许通过一些使用触发器或存储过程?如果是这样呢?

As per the MySQL manual "The CHECK clause is parsed but ignored by all storage engines." So I know the simple solution is out of the question but is there another feasible means of coming to the same outcome? Maybe through some use of triggers or stored procedures? If so how?

也因为它只是parsed是说,好像说避免使用它,因为它不能达到目的?

Also since it is just "parsed" is that as good as saying avoid using it since it doesn't serve a purpose?

使用MySQL 5.5.11和InnoDB表格

Using MySQL 5.5.11 and InnoDB tables

推荐答案

https:// wikis.oracle.com/display/mysql/Triggers#Triggers-EmulatingCheckConstraints

我经常使用该方法。

这篇关于MySQL CHECK约束替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆