SQL>
SQL> create table parts
2 (part_no number primary key,
3 part_name varchar2(20),
4 parent number);
Table created.
SQL>
SQL> insert into parts
2 values (4, 'part1' , 3)
3 /
1 row created.
SQL>
SQL> insert into parts
2 values (5, 'part2' , 3)
3 /
1 row created.
SQL>
SQL> insert into parts
2 values (6, 'part3' , 3)
3 /
1 row created.
SQL>
SQL> insert into parts
2 values (7, 'part4' , 6)
3 /
1 row created.
SQL>
SQL> insert into parts
2 values (10, 'part5' , null)
3 /
1 row created.
SQL>
SQL> insert into parts
2 values (2, 'part6' , 10)
3 /
1 row created.
SQL>
SQL> insert into parts
2 values (3, 'part7' , 10)
3 /
1 row created.
SQL>
SQL> alter table parts
2 add constraint fk_parent foreign key (parent) references parts;
Table altered.
SQL>
SQL>
SQL> drop table parts;
Table dropped.