2002-11-24 14:47:19 +01:00
|
|
|
drop table if exists t1;
|
|
|
|
create table t1 (a int check (a>0));
|
|
|
|
insert into t1 values (1);
|
|
|
|
insert into t1 values (0);
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int ,b int, check a>b);
|
|
|
|
insert into t1 values (1,0);
|
|
|
|
insert into t1 values (0,1);
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int ,b int, constraint abc check (a>b));
|
|
|
|
insert into t1 values (1,0);
|
|
|
|
insert into t1 values (0,1);
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int null);
|
|
|
|
insert into t1 values (1),(NULL);
|
|
|
|
drop table t1;
|
2003-12-02 16:06:24 +01:00
|
|
|
create table t1 (a int null);
|
|
|
|
alter table t1 add constraint constraint_1 unique (a);
|
|
|
|
alter table t1 add constraint unique key_1(a);
|
|
|
|
alter table t1 add constraint constraint_2 unique key_2(a);
|
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) default NULL,
|
2004-05-11 23:29:52 +02:00
|
|
|
UNIQUE KEY `constraint_1` (`a`),
|
|
|
|
UNIQUE KEY `key_1` (`a`),
|
|
|
|
UNIQUE KEY `key_2` (`a`)
|
2003-12-10 05:31:42 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
2003-12-02 16:06:24 +01:00
|
|
|
drop table t1;
|