Skip to content

Commit fb81cd1

Browse files
data_structures.sql
1 parent 93b240d commit fb81cd1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
drop view empview;
2+
drop view deptview;
3+
drop table departments cascade constraints;
4+
drop table employees cascade constraints;
5+
6+
create table departments
7+
as
8+
select *
9+
from hr.departments;
10+
11+
create table employees
12+
as
13+
select *
14+
from hr.employees;
15+
16+
alter table departments add primary key(department_id);
17+
alter table employees add primary key(employee_id);
18+
19+
create or replace json collection view empview
20+
as
21+
select json{'_id' : employee_id,
22+
last_name,
23+
hire_date,
24+
salary}
25+
from employees;
26+
27+
select *
28+
from user_json_collections;
29+
30+
create or replace json relational duality view deptview as
31+
select json {'_id' : department_id,
32+
'dname' : department_name,
33+
'location' : location_id}
34+
from departments with insert update delete;
35+

0 commit comments

Comments
 (0)