conn sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
drop user if exists testuser1 cascade;
create user testuser1 identified by testuser1
quota unlimited on users;
grant db_developer_role to testuser1;
grant select_catalog_role to testuser1;
conn testuser1/testuser1@//localhost:1521/freepdb1
drop table if exists sales purge;
drop table if exists customers purge;
create table customers (
customer_id number primary key,
age number,
gender varchar2(1)
);
insert into customers (customer_id, age, gender)
values (1, 35, 'F'),
(2, 54, 'M'),
(3, 17, 'F'),
(4, 15, 'M');
commit;
create table sales (
id number generated always as identity primary key,
sale_date date,
product_id number,
customer_id number,
sale_value number(10,2),
constraint sales_cust_fk foreign key (customer_id) references customers(customer_id)
);
create index sales_cust_fk_i on sales(customer_id);
insert into sales (sale_date, product_id, customer_id, sale_value)
select to_date('2022','yyyy'),
trunc(dbms_random.value(1,10)),
trunc(dbms_random.value(1,5)),
round(dbms_random.value(1,200),2)
from dual
connect by level < 10001;
commit;