- 博客(13)
- 收藏
- 关注
原创 pgpool2(流复制的主备模式)
pgpool2配置文件:pgpool.conf内容相同。delegate_ip 为pgpool2的集群vip。watchdog需要配置pgpool_node_id
2023-01-24 00:13:16 504 1
原创 PostgreSQL锁1
多个会话试图同时访问同一数据时,为了为每一个会话提供事务隔离,数据库会产生一些锁请求。 事务隔离级别以及可能出现的现象: 读末提交:可能出现脏读、不可重复读、幻读、序列化异常; 读已提交:可能出现不可重复读、幻读、序列化异常; 可重复读:可能出现幻读、序列化异常; 可序列化:无 解释: 脏读:一个事务读到了另一个末提交事务写入的数据; 不可重复读:一个事务再次读时,发现数据被其它事务update,delete改变了; 幻读:一个事务再次读时,发现被其它事务新insert的数据 ...
2022-03-30 00:04:26 659
原创 mysql维护
删除用户,修改密码: delete from mysql.user where... mysql> set password for 'root'@'localhost' =password('sbdxib'); mysql> flush privileges; Query OK, 0 rows affected (0.03 sec) 2.create user/database: mysql> creaate user 'sbdxib'@'%' identified by 'sbd.
2021-04-10 20:18:18 97
原创 1. mysql二进制版本安装
1.1 下载二进制安装文件 地址:https://downloads.mysql.com/archives/community/ 上传到/root [6.8 localhost ~ 0 32]# cat /etc/redhat-release CentOS release 6.8 (Final) [6.8 localhost ~ 0 33]# ll mysql-5.7.32-linux-glibc2.12-x86_64.tar.gz -rw-r--r-- 1 root root 661214270 3月
2021-04-10 15:55:45 120
原创 日期类型
date×tamp select sysdate-to_date('2019/03/17','yyyy/mm/dd') from dual; --number select sysdate-to_timestamp('2019/03/17','yyyy/mm/dd') from dual; --interval select systimestamp-1 from dual; ...
2019-03-19 22:09:16 124
原创 分析函数
# lag & lead select deptno,ename,hiredate, lag(hiredate) over(partition by deptno order by hiredate)last_a from emp; lead(field, num, defau) field需要查找的字段,num往后查找的num行的数据,defau没有符合条件的默认值 ...
2019-03-19 17:49:06 102 1
原创 sum() over
select sum(case job when 'CLERK' then sal end) as cl, sum(case job when 'MANAGER' then sal end) as ma from emp; select sum(decode(job,'CLERK',sal)) as cl, sum(decode(job,'MANAGER',sal)) ...
2019-03-19 16:40:39 1019
原创 串
select level from dual connect by level <=5; select regexp_count('ab,de,fg',',') from dual; select regexp_count('ab$cd$ef','\$') from dual; select length(regexp_replace('ab,de,fg','[^,]')) from dua...
2019-03-19 15:25:08 120
原创 单表查询
–conn scott/tiger select * from emp; select * from emp where (1=1); select * from ( select empno,sal 工资 from emp) where 工资<1000;–列别名在select以后才有效; select * from emp where comm is null; –coalesce(a,b,c,...
2019-03-19 12:50:39 127
原创 排序
select mid,us_phone,substr(us_phone,-3) as tail from tb_cy_memberinfo order by 3 null first/last;-- 3只能出现在order by 中, select translate(‘ab12cc’,’-12345’,’-’) from dual; select ename,sal, case when s...
2019-03-19 12:50:17 130
原创 更新插入
insert into t1 values(default,null,‘abc’); create view v1 as select a,b,c from t1;–建一个不包含有默认值的那一列的view insert into v1 values(); alter table emp add constraints constr1 check(sal>0); insert into(se...
2019-03-19 12:50:01 237
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人