create index f_ind11 on tab1(to_char(col1));
https://qiita.com/hmatsu47/items/128ece7276e4deac1477
(5.7)
生成カラム(generated column)
create table tab9(
col1 int,
col2 varchar(3),
col3 varchar(4) as ( CONCAT(col2,'0'))
);
insert into tab9(col1,col2) values(1,'abc');
alter table tab9 add index ind91(col3);
show create table tab9;
(8.0.18)
drop table tab1;
create table tab1 (
col1 varchar(100)
)
;
create index ind1 on tab1( ( substr(col1,3,3) ) );
drop table tab1;
create table tab1 (
birthdate date
)
;
create index ind1 on tab1( ( month(birthdate) ) );
create table tab3(col1 int ,col2 varchar(2));
CREATE INDEX f_ind31 ON tab3 (lower(col2));
計算列のインデックス
CREATE TABLE dbo.tab3
(
col1 int IDENTITY (1,1) NOT NULL
, col2 smallint
, col3 money
, col4 AS col2 * col3
);
INSERT INTO dbo.tab3 (col2, col3)
VALUES (25, 2.00), (10, 1.5);
create index f_ind31 on tab3(col4);