Anda mendapatkan hasil yang sama tanpa nol di depan.
Gunakan tipe data integer untuk membandingkan nilai integer.
Anda juga dapat mengonversi nilai dengan cepat menggunakan cast:
Contoh Anda dengan Cast:
select if( cast('00160001' as unsigned) between cast('0013001' as unsigned)
and cast('0023000' as unsigned),1,0) as test_a,
if( cast('00200000' as unsigned) between cast('0013001' as unsigned)
and cast('0023000' as unsigned),1,0) as test_b;