PostgreSQL select した数字の頭に0詰め

PostgreSQL select した数字の頭に0詰め

select した数字を6桁で頭に0詰めするにはto_charを使ってこうする

> select to_char(no, '000000') from sample;