case……when……
select
substring(身份证号,7,8) as 出生日期,
YEAR (now()) - YEAR (substring(身份证号, 7, 8)) 年龄,
CASE when Substring(身份证号,17,1)%2 = 1
then '男'
else '女' END AS 性别
from 转换
case……when……子句主要用于多种情况的分类
去重手法
mysql:create table temp select distinct * from 需要转换的表
sql server:select distinct * into temp from 需要转化的表
分列操作
参考:https://deepinout.com/mysql/mysql-questions/t_how-to-split-a-column-in-mysql.html