티스토리 뷰

DB

[PostgreSQL] numeric와 integer차이점

MC's Father 2020. 7. 14. 17:08

Numeric

정수 또는 소수 값을 저장

Oracle 에서의 Number, MySQL Decimal 와 같은 의미로 보면 된다.

Numeric(p,s) 실수(10진수) p : , s: 소수점 자리수 

  ex ) numeric(7,3) -> 전체자리는 7자리, 소수점 3자리를 의미함

Integer

오직 정수만 저장

 

 

NameStorage SizeDescriptionRange

smallint 2 bytes small-range integer -32768 to +32767
integer 4 bytes typical choice for integer -2147483648 to +2147483647
bigint 8 bytes large-range integer -9223372036854775808 to 9223372036854775807
decimal variable user-specified precision, exact up to 131072 digits before the decimal point; up to 16383 digits after the decimal point
numeric variable user-specified precision, exact up to 131072 digits before the decimal point; up to 16383 digits after the decimal point
real 4 bytes variable-precision, inexact 6 decimal digits precision
double precision 8 bytes variable-precision, inexact 15 decimal digits precision
serial 4 bytes autoincrementing integer 1 to 2147483647
bigserial 8 bytes large autoincrementing integer 1 to 9223372036854775807

https://www.postgresql.org/docs/9.1/datatype-numeric.html

 

PostgreSQL: Documentation: 9.1: Numeric Types

Numeric types consist of two-, four-, and eight-byte integers, four- and eight-byte floating-point numbers, and selectable-precision decimals. Table 8-2 lists the available types. Table 8-2. Numeric Types Name Storage Size Description Range smallint 2 byte

www.postgresql.org

 

'DB' 카테고리의 다른 글

[PostgreSQL] character varying 와 varchar 차이점  (0) 2020.07.14
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함