博客
这里发布本站的最近动态
node-postgres 一条语句更新多条数据
   1 分钟阅读
单条更新到是 1 UPDATE accounts SET balance=$2,count=$3 WHERE account=$1 但是这条语句在 commit 这种批量提交的时候就非常尴尬了; 批量提交的可以看 commit使用教程 ,这种方式在性能方面会比较好 代
node-postgres 中 where-in 实现
   1 分钟阅读
因为是在 nodejs 中使用的(基于 node-postgres) 不能直接使用 where in 功能 错误的用法 比如在原生 SQL 中的下面语句 1 2 select account from accounts where account in ('czr_3ijpzyoofukqrhjyqk5ma6c64m44fexc1idta7necszksbj6urfqq7yu3dsy','czr_1aptm6u579y1gx548hj7nmehtu3jmduxmp9pwm4abxyiartcd5kd4ofw1dyd') 转成 where 如下 1 2
NodeJS 基于 pg 封装的 postgresql
   2 分钟阅读
场景:使用 Nodejs 操作 PostgreSQL 数据库 在 npm 官网找到一个热度非常不错的包 pg 文档在这里:pg的使用文档 封装为模块方便使用 文件名为 PG.js , 代码如下 1 2 3 4 5 6 7 8 9
SQL 语句创建 postgresql 表
   3 分钟阅读
语句如下 账户表创建 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 -- Table: public.accounts -- DROP TABLE public.accounts; CREATE TABLE public.accounts (