PostgreSQLMySQL相容性之-時間型別
DATE
MySQL
DATE
A date. The supported range is `1000-01-01` to `9999-12-31`.
`0000-00-00` is a permitted special value (zero-date), unless the NO_ZERO_DATE SQL_MODE is used.
Also, individual components of a date can be set to 0 (for example: `2015-00-12`), unless the NO_ZERO_IN_DATE SQL_MODE is used.
PostgreSQL
DATE
但是PG不支援`0000-00-00`, 通過改原始碼 ValidateDate, 自動將`0000-00-00`轉存為`0001-01-01 BC`
TIME
MySQL
TIME [(<microsecond precision>)]
A time. The range is `-838:59:59.999999` to `838:59:59.999999`. Microsecond precision can be from 0-6; if not specified 0 is used.
PostgreSQL
TIME [(<microsecond precision>)]
DATETIME
MySQL
DATETIME [(microsecond precision)]
A date and time combination. The supported range is `1000-01-01 00:00:00.000000` to `9999-12-31 23:59:59.999999`.
MariaDB displays DATETIME values in `YYYY-MM-DD HH:MM:SS` format, but allows assignment of values to DATETIME columns using either strings or numbers.
`0000-00-00` is a permitted special value (zero-date), unless the NO_ZERO_DATE SQL_MODE is used.
Also, individual components of a date can be set to 0 (for example: `2015-00-12`), unless the NO_ZERO_IN_DATE SQL_MODE is used.
In many cases, the result of en expression involving a zero-date, or a date with zero-parts, is NULL.
If the ALLOW_INVALID_DATES SQL_MODE is enabled, if the day part is in the range between 1 and 31, the date does not produce any error, even for months that have less than 31 days.
PostgreSQL
timestamp [(microsecond precision)]
timestamptz [(microsecond precision)]
char([M])
TIMESTAMP
MySQL
TIMESTAMP [(<microsecond precision)]
A timestamp in the format YYYY-MM-DD HH:MM:DD.
The timestamp field is generally used to define at which moment in time a row was added or updated and by default will automatically be assigned the current datetime when a record is inserted or updated.
PostgreSQL
timestamp [(microsecond precision)]
timestamptz [(microsecond precision)]
YEAR
MySQL
YEAR[(4)]
A year in two-digit or four-digit format. The default is four-digit format. Note that the two-digit format has been deprecated since 5.5.27.
In four-digit format, the allowable values are 1901 to 2155, and 0000.
PostgreSQL
postgres=# create domain year as int2 constraint ck check (value between 1901 and 2155);
CREATE DOMAIN
相關文章
- 時間型別和時間戳型別時間戳
- Flink 的時間型別型別
- Oracle實驗(05):時間型別Oracle型別
- go 把時間儲存到 MongoDB , 時間是 time 型別MongoDB型別
- lodash原始碼分析之資料型別獲取的相容性原始碼資料型別
- XSD 日期和時間資料型別資料型別
- PostgreSQL:時間——型別、運算子和函式SQL型別函式
- Map和String型別之間的轉換型別
- MySQL時間型別和模式詳情陸轄MySql型別模式
- java基本型別和物件之間的轉換Java型別物件
- python不同資料型別之間的區別有什麼?Python資料型別
- 淺談Go型別轉換之間的那些事Go型別
- 淺談 Go 型別轉換之間的那些事Go型別
- 5.JavaScript資料型別之間的轉換JavaScript資料型別
- Redis基礎、常用型別介紹、時間複雜度Redis型別時間複雜度
- 軟體相容性測試包含哪幾種型別?相容性測試如何收費?型別
- PostgreSQLOracle相容性之-全域性臨時表globaltemptableSQLOracle
- JAVA_資料型別介紹與基本資料型別之間的運算規則Java資料型別
- Mysql 資料型別之整數型別MySQL 資料型別
- Linux系統中檔案時間常用的三種型別!Linux型別
- 資料庫儲存時間到底該用什麼型別?資料庫型別
- 課時5:閒聊之Python的資料型別Python資料型別
- Javascrip 之 字串處理 & 定時器 & 型別轉換Java字串定時器型別
- 7.GoLang中基本資料型別之間的轉換Golang資料型別
- TS系列之型別型別
- 操作型別之字串型別字串
- 引用型別之Object型別Object
- Python之字元型別Python字元型別
- js基本語法之 值型別(資料型別)(變數型別)JS資料型別變數
- HTML5有哪些儲存型別?它們之間有什麼區別?HTML型別
- Go基礎知識-04 時間和日期型別(持續更新)Go型別
- mysql 時間型別秒級資料,取分鐘資料方案MySql型別
- 布林型盲注 時間型盲注
- js資料型別之基本資料型別和引用資料型別JS資料型別
- python資料庫查詢返回時間為datetime型別時候的特殊處理Python資料庫型別
- Linux系統把時間型別值轉換為數值型的方法是什麼?Linux型別
- 如何橋接優化Java方法返回型別實現相容性? - Gunnar橋接優化Java型別
- SQL SERVER 日期和時間資料型別及函式 (Transact-SQL)SQLServer資料型別函式
- 【SpringBoot】 中時間型別 序列化、反序列化、格式處理Spring Boot型別