1. create table student
  2. (
  3. id bigint auto_increment
  4. primary key,
  5. age bigint not null,
  6. name varchar(256) not null,
  7. score int not null
  8. );
  9. create index idx_age_score
  10. on student (age, score);

image.png

情景1:age 为 bigint 类型,查询为 varchar

1.1 入参前缀为数字开头

会将数字截取,然后全匹配,如果存在,则查询出来。
image.png
image.png

1.2 入参前缀不为数字开头

image.png


情景2:name为varchar类型,传入类型为 bigint

2.1 当传入 值为 0 时

image.png

2.2 当传入值为 2 时

image.png

结论