postgres常用類型

來源:互聯網
上載者:User

標籤:des   style   io   os   ar   strong   sp   on   c   

數實值型別

 

名字 儲存空間 描述 範圍
smallint 2 位元組 小範圍整數 -32768 到 +32767
integer 4 位元組 常用的整數 -2147483648 到 +2147483647
bigint 8 位元組 大範圍的整數 -9223372036854775808 到 9223372036854775807
decimal 變長 使用者聲明精度,精確 無限制
numeric 變長 使用者聲明精度,精確 無限制
real 4 位元組 變精度,不精確 6 位十進位數字精度
double 8 位元組 變精度,不精確 15 位十進位數字精度
serial 4 位元組 自增整數 1 到 +2147483647
bigserial 8 位元組 大範圍的自增整數 1 到 9223372036854775807

 

 

 

 

 

 

 

 

 字元類型

 

名字 描述
varchar(n) 變長,有長度限制
char(n) 定長,不足補空白
text 變長,無長度限制
   日期時間類型

 

名字 儲存空間 描述 格式
timestamp[無時區] 8位元組 包括日期和時間 1999-01-08 04:05:06
timestamp[含時區] 8位元組 日期和時間,帶時區 1999-01-08 04:05:06+8
interval 12位元組 時間間隔 7 hours
date 4位元組 只用於日期 1999-01-08
time[無時區] 8位元組 只用於一日內時間 04:05:06
    布爾類型

 

True False
t f
true false
y f
yes no
1 0

 

   

 

數群組類型

interger[]

text[]

PostgreSQL中數組元素的下標是從1開始

數組形式:‘{"中文描述", "english description"}‘

 

postgres常用類型

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.