mysql fuzzy query - varchar field stores numeric type

When looking up all the districts I used:

SELECT * FROM SYS_CITY WHERE CITY_CODE LIKE '_____[0-9]'

Then I found that no matter how I checked the data, I couldn't find it.

I later changed it to the following:

SELECT * FROM SYS_CITY WHERE CITY_CODE%100 != 0

Just found out.

Although the type of CITY_CODE is the type of varchar, the field actually stores the numeric type.

This feeling involves the storage mechanism of mysql. The specific type should be determined according to the type of storage.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325734304&siteId=291194637