Currency modeling in database

前端 未结 4 2152
情书的邮戳
情书的邮戳 2020-12-19 08:35

A very naive question. I need to store currency in the database. Both the value and the code. To solve this, do people generally make 2 columns, one storing the value and ot

4条回答
  •  醉酒成梦
    2020-12-19 09:20

    Some databases have a Money type, which can be used to store the value. However, if you want to store a code (do you mean dollars, euro's etc?) then you would need to use a second column.

    Update: PostgreSQL does have a money type, although it looks like it would only support one type of currency so it still does not really meet your needs.

提交回复
热议问题