The rules for judging men and women according to the ID card: the second-generation ID card has 18 digits, and the penultimate digit is judged. If the second digit is an odd number, the gender is male; the even number is female
The first-generation ID card is 15, and the judgment is the last one, and the rules are the same as above.
update tablename set tablename.fieldname=
case when substring(table name, ID card field, 17,1)%2=1 and length(table name. ID card field) =18 then "male"
when substring(table name, ID card field, 17,1)%2=0 and length(table name. ID card field) =18 then "female"
when substring(table name, ID field, 15,1)%2=1 and length(table name. ID field) =15 then "male"
when substring(table name, ID card field, 15,1)%2=0 and length(table name. ID card field) =15 then "female"