随笔分类 - sql
摘要:1、问题 新建的pgsql数据库,在执行select uuid_generate_v4()时报错。 function uuid_generate_v4() does not exist 2、原因 函数未定义:PostgreSQL 没有加载 uuid-ossp 模块,该模块包含 uuid_genera
阅读全文
摘要:1、创建一个用户名为<readonlyuser>,密码为<your_password>的用户 CREATE USER <readonlyuser> WITH ENCRYPTED PASSWORD '<your_password>'; 2、修改用户只读事务属性 ALTER USER <readonly
阅读全文
摘要:1、需求 现在有一个数组:[1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10] 要求去重后展示 2、可以使用pgsql中的unnest和array方法 SELECT DISTINCT unnest(array[1, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 1
阅读全文
摘要:需要根据上图的数据得到下图的结果 需要使用到的函数: group_concat() sql示例: select username,realname,group_concat(rolename separator ',') rolename from usertest group by usernam
阅读全文