drop table bomComp cascade constraints; 
drop table bomPrice cascade constraints;

create table bomComp 
( 
  part     varchar2(20), 
  subPart  varchar2(20), 
  quantity number not null, 
  ptype     char check (ptype in ('c', 'b')), 
  primary key (part, subpart) 
); 

create table bomPrice 
( 
  part   varchar2(20) primary key, 
  bomPrice  number(6,2) not null 
); 

insert into bomComp values ('engine','sparkplug',4,'b');
insert into bomComp values ('engine','cylinder',4,'c');
insert into bomComp values ('engine','valve',4,'c');
insert into bomComp values ('engine','crankshaft',1,'c');
insert into bomComp values ('cylinder','piston',1,'c');
insert into bomComp values ('cylinder','connectingrod',1,'c');
insert into bomComp values ('valve','gasket',1,'b');
insert into bomComp values ('valve','hanger',2,'c');
insert into bomComp values ('crankshaft','joint',8,'c');
insert into bomComp values ('piston','screw',2,'b');
insert into bomComp values ('piston','gasket',3,'b');
insert into bomComp values ('connectingrod','screw',4,'b');
insert into bomComp values ('connectingrod','bolt',4,'b');
insert into bomComp values ('hanger','screw',4,'b');
insert into bomComp values ('hanger','bolt',2,'b');
insert into bomComp values ('joint','screw',10,'b');
insert into bomComp values ('joint','bolt',20,'b');

insert into bomPrice values ('sparkplug',10);
insert into bomPrice values ('screw',2);
insert into bomPrice values ('gasket',3);
insert into bomPrice values ('bolt',2);
