大数据
-
解析PostgreSQL中Oid和Relfilenode的映射问题
作者李传成中国PG分会认证专家,瀚高软件资深内核研发工程师https://zhuanlan.zhihu.com/p/342466054 PostgreSQL中的表会有一个RelFileNode值指定这个表在磁盘上的文件名(外部表、分区表除外)。一般情况下在pg_cl…
-
PostgreSQL regexp_matches替换like模糊查询的操作
我就废话不多说了,大家还是直接看代码吧~ 改前: select * from 表名 where 字段名 like ||#{参数}||'%' 改后: select *,regexp_matches(字段名, #{参数}) from 表名 补充:postgresql实现模糊查询 正则表达式 因…
-
postgresql 实现replace into功能的代码
PostgreSQL 9.5- 使用函数或with实现 create table test(id int primary key, info text, crt_time timestamp); with upsert as (update test set info='test',crt_time=now() where id=1 returning *) insert into…
-
postgresql 替换空格 换行和回车的操作
我就废话不多说了,大家还是直接看代码吧~ UPDATE table set name = trim(name);//用来删除数据前后的空格 UPDATE table set name = rtrim(name);//用来删除数据前的空格 UPDATE table set name = ltrim(name);//用…
-
pg中replace和translate的用法说明(数据少的中文排序)
1.首先创建students表 CREATE TABLE students ( id integer NOT NULL, name character varying(255), sex character varying(255), class character varying(255), "like" character varying(255), school characte…
-
PostgreSQL 远程连接配置操作
postgre一般默认为本地连接,不支持远程访问,所以如果要开启远程访问,需要更改安装文件的配置。 打开安装目录下的data文件,我一般安装在D盘,我安装的postgre是64位,所以,安装目录为D:/Program Files/PostgreS…
-
postgreSQL中的内连接和外连接实现操作
测试数据: city表: create table city(id int,name text); insert into city values(0,'北京'),(1,'西安'),(2,'天津'),(3,'上海'),(4,'哈尔滨'),(5,'西藏') person表: create table person(id int,lastname char…
-
postgreSQL中的case用法说明
工具:postgreSQL Navicat Premium 又一次在看代码的时候,发现了不懂的东西! 这次就是case when then SQL CASE表达式是一种通用的条件表达式,类似于其它语言中的if/else语句。 CASE WHEN condition THEN result …
-
基于postgreSql 常用查询小结
1. 日期格式转化(参考) select beg_time, end_time, extract(epoch from to_timestamp(end_time,'yyyy-mm-dd-HH24-MI-SS-US'))-extract(epoch from to_timestamp(beg_time,'yyyy-mm-dd-HH24-MI-SS-US')) from cdb…
-
postgresql 查询字符串中是否包含某字符的操作
先看表结构和数据: 需求: 查询出manager_id中包含某些字符的数据,此处查询manager_id包含6651545956882725395,5722501350582149881的数据, SQL语句如下: SELECT t.* from bas_cm_customer t where position('…