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
相關文章
- PostgreSQLMySQL相容性之-Gis型別MySql型別
- PostgreSQLMySQL相容性之-數字型別MySql型別
- 【MySQL資料型別2之--日期時間型別】MySql資料型別
- 時間型別型別
- 時間型別和時間戳型別時間戳
- 字元型別轉換成時間型別字元型別
- 時間物件、引用型別物件型別
- Flink 的時間型別型別
- 時間型別interval year to month型別
- 【Mysql 學習】時間型別MySql型別
- sqlserver 時間型別 轉化SQLServer型別
- Oracle實驗(05):時間型別Oracle型別
- 時間型別及格式轉換型別
- MySql與Java的時間型別MySqlJava型別
- go 把時間儲存到 MongoDB , 時間是 time 型別MongoDB型別
- Mysql 基礎資料型別(無時間相關型別)MySql資料型別
- 有關sql時間型別及格式SQL型別
- lodash原始碼分析之資料型別獲取的相容性原始碼資料型別
- int型別和long long型別運算執行時間的差別型別
- NSData之間資料型別轉化資料型別
- Mysql資料庫學習(二):資料型別(數值型別 日期和時間型別 字串型別)MySql資料庫資料型別字串
- PostgreSQL:時間——型別、運算子和函式SQL型別函式
- XSD 日期和時間資料型別資料型別
- 【MySQL】時間型別儲存格式選擇MySql型別
- (轉)PLS_INTEGER型別與timestamp型別、date、及時間函式型別函式
- Java 資料型別之間的轉換Java資料型別
- 字串和Date型別之間的轉換字串型別
- MySQL時間型別和模式詳情陸轄MySql型別模式
- Date型別使用Calendar進行時間運算型別
- Oracle時間型別資料為0的bugOracle型別
- Map和String型別之間的轉換型別
- js中各個型別之間的比較JS型別
- date和timestamp型別之間的轉換型別
- java基本型別和物件之間的轉換Java型別物件
- Java中將時間戳轉化為Date型別Java時間戳型別
- 各種時間型別的轉換及比較型別
- 淺談 Go 型別轉換之間的那些事Go型別
- 淺談Go型別轉換之間的那些事Go型別