CREATE TABLE t1 (
sca_code char(6) NOT NULL,
cat_code char(6) NOT NULL,
lan_code char(2) NOT NULL,
sca_pic varchar(100),
sca_sdesc varchar(50),
sca_sch_desc varchar(16)
, PRIMARY KEY (sca_code, cat_code, lan_code)
) Engine = Falcon ;
INSERT INTO t1 ( sca_code, cat_code, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES
( 'PD', 'J', 'EN', NULL, NULL, 'PENDANT'),
( 'RI', 'J', 'EN', NULL, NULL, 'RING'),
( 'QQ', 'N', 'EN', 'not null', NULL, 'RING');
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_pic >= 'n';
count(*)
1
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
select count(*) from t1 where sca_pic >= 'n';
count(*)
1
DROP TABLE t1;
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
CREATE TABLE t1 (
sca_code char(6) NOT NULL,
cat_code char(6) NOT NULL,
sca_desc varchar(50),
lan_code char(2) NOT NULL,
sca_pic varchar(100),
sca_sdesc varchar(50),
sca_sch_desc varchar(16),
PRIMARY KEY (sca_code, cat_code, lan_code),
INDEX sca_pic (sca_pic)
) Engine = Falcon ;
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'
),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
select count(*) from t1 where sca_code = 'PD';
count(*)
1
select count(*) from t1 where sca_code <= 'PD';
count(*)
1
select count(*) from t1 where sca_pic is null;
count(*)
2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
select count(*) from t1 where cat_code='E';
count(*)
0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
select count(*) from t1 where sca_pic >= 'n';
count(*)
1
select sca_pic from t1 where sca_pic is null;
sca_pic
NULL
NULL
update t1 set sca_pic="test" where sca_pic is null;
delete from t1 where sca_code='pd';
DROP TABLE t1;
