with recursive fb_list(n1, n2) as
(
select 0, 1
union all
select n2, n1+n2 from fb_list where n1 + n2 <=100
)
select 0
union all
select n2 from fb_list;
(
select 0, 1
union all
select n2, n1+n2 from fb_list where n1 + n2 <=100
)
select 0
union all
select n2 from fb_list;
2019-11-05
set default role 'app_write' to 'write01','write02';
create user 'write02' identified by 'write02';
grant 'app_developer' to 'dev01','dev02','dev03';
grant 'app_read' to 'read01','read02'';
grant 'app_write'to 'write01','write02';
set default role 'app_developer' to 'dev01','dev02','dev03';
set default role 'app_read' to 'read01','read02';
grant 'app_developer' to 'dev01','dev02','dev03';
grant 'app_read' to 'read01','read02'';
grant 'app_write'to 'write01','write02';
set default role 'app_developer' to 'dev01','dev02','dev03';
set default role 'app_read' to 'read01','read02';
create user 'dev01' identified by 'dev01';
create user 'dev02‘ identified by 'dev02';
create user ’dev03' identified by 'dev03';
create user 'read01‘ identified by 'read01';
create user 'read02' identified by 'read02';
create user 'write01' identified by 'write01';
create user 'dev02‘ identified by 'dev02';
create user ’dev03' identified by 'dev03';
create user 'read01‘ identified by 'read01';
create user 'read02' identified by 'read02';
create user 'write01' identified by 'write01';
create database appdb;
create table appdb.t1(id int);
create role 'app_developer','app_read','app_write';
grant all on appdb.* to 'app_developer';
grant select on appdb.* to 'app_read';
grant insert,update,delete on appdb.* to 'app_write';
create table appdb.t1(id int);
create role 'app_developer','app_read','app_write';
grant all on appdb.* to 'app_developer';
grant select on appdb.* to 'app_read';
grant insert,update,delete on appdb.* to 'app_write';
斐波那契数列
1.限定最大值
with recursive cte(m, n) as (
select 0, 1
union all
select n, m+n from cte where n<100
) select m from cte;
2.限定位数
with recursive cte(id, m, n) as (
select 0, 0, 1
union all
select id+1, n, m+n from cte where id<10
) select m from cte;
1.限定最大值
with recursive cte(m, n) as (
select 0, 1
union all
select n, m+n from cte where n<100
) select m from cte;
2.限定位数
with recursive cte(id, m, n) as (
select 0, 0, 1
union all
select id+1, n, m+n from cte where id<10
) select m from cte;
2019-09-28
读取权限
create role 'read_role';
grant select on appdb.* to 'read_role';
create user 'read01' identified by 'Read01@2019';
grant 'read_role' to 'read01';
show grants for 'read01' using 'read_role';
create role 'read_role';
grant select on appdb.* to 'read_role';
create user 'read01' identified by 'Read01@2019';
grant 'read_role' to 'read01';
show grants for 'read01' using 'read_role';