create table customers ( cno number(5) not null primary key, cname varchar2(30), street varchar2(30), zip number(5) references zipcodes, phone char(12)); drop table orders cascade constraints; create table orders ( ono number(5) not null primary key, cno number(5) references customers, eno number(4) references employees, received date, shipped date); drop table odetails cascade constraints; create table odetails ( ono number(5) not null references orders, pno number(5) not null references parts, qty integer check(qty > 0), primary key (ono,pno)); --------------------------------------------------------------- -- insert_object.sql -- Grade Book Database; Create Tables Script -- Chapter 2; Oracle 9i Programming -- A Primer -- by R. Sunderraman --------------------------------------------------------------- insert into o_employees values (1000, person_type('Jones', address_type('123 Main St','Wichita','KS',67226), phones_varray_type('316-555-1212',null,null)), '12-DEC-95'); insert into o_employees values (1001, person_type('Smith', address_type('101 Elm St','Fort Dodge','KS',60606), '01-JAN-92'); insert into o_employees values (1002, person_type('Brown', address_type('100 Elm St','Kansas City','KS',50302), phones_varray_type('780-555-1111',null,null)),
create table customers ( cno number(5) not null primary key, cname varchar2(30), street varchar2(30), zip number(5) references zipcodes, phone char(12)); drop table orders cascade constraints; create table orders ( ono number(5) not null primary key, cno number(5) references customers, eno number(4) references employees, received date, shipped date); drop table odetails cascade constraints; create table odetails ( ono number(5) not null references orders, pno number(5) not null references parts, qty integer check(qty > 0), primary key (ono,pno)); --------------------------------------------------------------- -- insert_object.sql -- Grade Book Database; Create Tables Script -- Chapter 2; Oracle 9i Programming -- A Primer -- by R. Sunderraman --------------------------------------------------------------- insert into o_employees values (1000, person_type('Jones', address_type('123 Main St','Wichita','KS',67226), phones_varray_type('316-555-1212',null,null)), '12-DEC-95'); insert into o_employees values (1001, person_type('Smith', address_type('101 Elm St','Fort Dodge','KS',60606), '01-JAN-92'); insert into o_employees values (1002, person_type('Brown', address_type('100 Elm St','Kansas City','KS',50302), phones_varray_type('780-555-1111',null,null)),