Mikä hemmetti mättää?
mysql> create table taulu( id int not null auto_increment primary key, parent int not null default 0 check( parent < id ));
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql> insert into taulu(parent) values(3);
Query OK, 1 row affected (0.00 sec)
mysql> select * from taulu;
---- --------
| id | parent |
---- --------
| 1 | 3 |
---- --------
1 row in set (0.00 sec)
mysql>
mysql> create table taulu( id int not null auto_increment primary key, parent int not null default 0 check( parent < id ));
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql> insert into taulu(parent) values(3);
Query OK, 1 row affected (0.00 sec)
mysql> select * from taulu;
---- --------
| id | parent |
---- --------
| 1 | 3 |
---- --------
1 row in set (0.00 sec)
mysql>
Vastaukset 1
Vanhimmat
Nopeasti googlettamalla MySQL:n checkiä ei huomioida.