Home > database >  Former urgent: according to the department first, then according to the set of queries in parent-chi
Former urgent: according to the department first, then according to the set of queries in parent-chi

Time:05-15



- create staff table
The create table employee (
Emp_id number (18), - personnel ID
Lead_id number (18), - superior personnel ID
Emp_name varchar2 (200) - researchers name
Salary number (1, 2), wages,
Dept_no varchar2 (8) - department of type A/B
);

- insert the following deliberately disrupt data
Insert into the employee values (' 1 ', 0 'king', '1000000.00', 'A');
Insert into the employee values (' 3 ', 1, 'arise,' 60000.00 ', 'A');
Insert into the employee values (' 2 ', 1, 'jack', '50500.00', 'A');
Insert into the employee values (' 4 ', 2, 'Scott', '30000.00', 'A');
Insert into the employee values (' 6 '3' wudde ', '23000.00', 'A');
Insert into the employee values (' 5 '2,' the tiger ', '25000.00', 'A');

Insert into the employee values (' 3 ', 1, 'arise,' 60000.00 ', 'B');
Insert into the employee values (' 2 ', 1, 'jack', '50500.00', 'B');
Insert into the employee values (' 4 ', 2, 'Scott', '30000.00', 'B');
Insert into the employee values (' 6 '3' wudde ', '23000.00', 'B');
Insert into the employee values (' 5 '2,' the tiger ', '25000.00', 'B');
Insert into the employee values (' 1 ', 0 'king', '1000000.00', 'B');

- don't insert] [the following data is ordered below father-son relationship data, is the desired effect, also can refer to the final effect picture
Insert into the employee values (' 1 ', 0 'king', '1000000.00', 'A');
insert into the employee values (' 2 ', 1, 'jack', '50500.00', 'A');
Insert into the employee values (' 3 ', 1, 'arise,' 60000.00 ', 'A');

insert into the employee values (' 4 ', 2, 'Scott', '30000.00', 'A');
Insert into the employee values (' 5 '2,' the tiger ', '25000.00', 'A');

Insert into the employee values (' 6 '3' wudde ', '23000.00', 'A');
  • Related