-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbootcamp.session.sql
37 lines (25 loc) · 978 Bytes
/
bootcamp.session.sql
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
-- drop table if exists bootcamp.df;
-- create table bootcamp.df (customer_code varchar(16),
-- contract_code varchar(16),
-- product varchar(16),
-- num_products int);
-- insert into bootcamp.df values
-- ('C0134', 'AB01245', 'toy_1', 4),
-- ('B8328', 'EF28421', 'doll_4', 2);
-- select * from bootcamp.df;
-- with recursive nums (n) as
-- ( select 1 as n
-- union all
-- select n+1 as n
-- from nums
-- where n < (select max(num_products) from bootcamp.df) )
-- select row_number() over() as unique_id, customer_code, contract_code, product, num_products
-- from bootcamp.df d
-- left join nums n
-- on d.num_products >= n.n;
-- drop table if exists bootcamp.df;
-- select * from pg_user;
alter schema laptop11_library owner to laptop11;
grant usage on schema laptop11_library to laptop11;
grant all on laptop11_library.tbl_accounts to laptop11;
grant all on laptop11_library.tbl_accounts to laptop11;