1auto_increment 转换成SERIAL

2concat 转换成 ||

3date_format 转换成 to_char

4ifnull 转换成 coalesce($1, $2)

5PostgreSQL HAVING 子句不能使用别名。

select name, count(*) as score

from mytable

group by name

having score > 10

转换成

select name, count(*) as score

from mytable

group by name

having count(*) > 10