假设我有一个名为 MyTable 的表,其时间戳字段为“已创建”。我只想提取本专栏的日期部分,在我的研究中我发现了这些替代方案:
SELECT created AS "Original",
date(created) AS "DateFunction",
created::date AS "DoubleColonCast",
cast(created as date) AS "CastFunction",
date_trunc('day', created) AS "DateTrunc"
FROM MyTable
- 就SARGability 而言,首选方法是什么?
- 什么是“SQL ANSI”(即更便携)方式?
- Postgres 中最常见/最常用的是什么?