Skip to content

Commit d756b71

Browse files
authored
Create 1-create-partitioned-table.sql
1 parent d3e97a5 commit d756b71

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
REM Script: 1-create-partitioned-table.sql
2+
REM Use data from HR table EMPLOYEES
3+
4+
-- prereq EMPLOYEES table from HR schema
5+
-- HR schema available in https://github.com/oracle-samples/db-sample-schemas/blob/main/human_resources/hr_create.sql
6+
7+
8+
DROP TABLE hr.employees_hybrid;
9+
10+
CREATE TABLE hr.employees_hybrid
11+
( EMPLOYEE_ID varchar2(10),
12+
SALARY number,
13+
JOB_TITLE varchar2 (35))
14+
PARTITION BY RANGE (salary)
15+
( PARTITION salary_4000 VALUES less than (4000), -- internal partition
16+
PARTITION salary_10000 VALUES less than (10000), -- internal partition
17+
PARTITION salary_30000 VALUES less than (30000), -- intern partition
18+
PARTITION salary_max values less than (MAXVALUE))
19+
/
20+
21+
-- insert rows
22+
23+
INSERT INTO hr.employees_hybrid
24+
SELECT e.employee_id, e.salary, j.job_title
25+
FROM hr.employees e JOIN hr.jobs j ON e.job_id=j.job_id;
26+
27+
COMMIT;

0 commit comments

Comments
 (0)