check约束好像不起作用啊?!情况如下:mysql> create table t (c1 integer check (c1 < 50));
Query OK, 0 rows affected (0.03 sec)mysql> insert into t values(20);
Query OK, 1 row affected (0.00 sec)mysql> insert into t values(60);
Query OK, 1 row affected (0.00 sec)mysql> select * from t;
+------+
| c1 |
+------+
| 20 |
| 60 |
+------+
2 rows in set (0.00 sec)怎么回事?谢谢!
Query OK, 0 rows affected (0.03 sec)mysql> insert into t values(20);
Query OK, 1 row affected (0.00 sec)mysql> insert into t values(60);
Query OK, 1 row affected (0.00 sec)mysql> select * from t;
+------+
| c1 |
+------+
| 20 |
| 60 |
+------+
2 rows in set (0.00 sec)怎么回事?谢谢!
解决方案 »
- 求一条sql语句(内容分类查询相关)
- mysql5.0数据实时更新问题
- Mysql 按照字段长度排序,该怎么写啊~在线等待~
- mysql 备份问题,主、外键关联过不来
- MySQL 存储过程的问题,急~~~~
- 如何启动mysql服务?
- MYSQL ERROR:Can't get stat of 'C:\Program Files\Borland\CBuilder6\Projects\DBclient\Book1.csv'
- 一个有关远程数据库连接的问题。
- phpMyAdmin打开是空白的
- 【#1424】mysql 如何才可以创建这样一个函数?无限级分类的自动定位
- mysql存数据
- mysql master-slave 同步错误。
[/align]
For other storage engines, the clauses are parsed but ignored. The CHECK clause is parsed but ignored by all storage engines.
The reason for accepting but ignoring syntax clauses is for compatibility, to make it easier to port code from other SQL servers, and to run applications that create tables with references.[align=center]==== 思想重于技巧 ====
[/align]
MYSQL加了这个只是为了对移植到其他数据库提供方便。
难道不能添加了吗??????
[/align]
那我要建个 范围在100-200的int型数据 别人输入201就会报错
岂不是不可能?
2. 换数据库[align=center]==== 思想重于技巧 ====
[/align]