「sql」话题下的全部文章,按时间倒序排列;右侧可继续浏览相关话题与最近更新的内容。
依据PostgreSQL官方functions-math文档原文讲清sql四舍五入:官方定义ceil为greater than or equal、floor为less than or equal、trunc为truncates towards zero而round是Rounds to nearest integer;最隐蔽的坑来自Division (for int...
依据PostgreSQL官方functions-string文档原文讲清SQL字符串替换:replace定义是Replaces all occurrences in string of substring from with substring to即一次全量且精确匹配,而regexp_replace默认Replaces the substring that is t...
依据PostgreSQL官方7.4节Combining Queries(UNION, INTERSECT, EXCEPT)原文讲清SQLMINUS:EXCEPT是标准SQL而MINUS是Oracle私有写法迁移会报语法错,duplicates are eliminated unless ALL is specified故数据对账须用EXCEPT ALL按重数...
依据PostgreSQL官方ddl-identity-columns文档原文讲清SQLIDENTITY:恒等列由implicit sequence自动生成键值且数据类型必须为序列支持类型,语法有GENERATED ALWAYS AS IDENTITY与GENERATED BY DEFAULT AS IDENTITY两种,ALWA...
依据PostgreSQL官方queries-order与SELECT参考页原文讲清orderbydesc:ascending order is the default且每列方向独立不继承,故ORDER BY x, y DESC中x仍是升序;默认null values sort as if larger than any non-null value即Postgre...
解析SQL中ORDER BY ... DESC的语法位置与多字段排序优先级,说明MySQL与PostgreSQL对NULL排列的默认差异及NULLS LAST写法,指出并列值导致翻页重复或丢行的排序不稳定问题并要求追加唯一列做tiebreaker或...