Contents
Oracle- Forms - PL/SQL
Database
Orders and Tables
PL/SQL
Oracle- Forms
© The scientific sentence. 2010
| table insurance
Preface:
--------
This ket of six tables represents the relations regarding
an insurance database. A customer can debit (reumbersment) the account,
credit it (payment) and claim (demand for due). A customer also
is registered in a certain branch with a certain policy number.
The schema of an insurance is more developed. Here is just a simple
example.
1. Creating the tables:
-----------------------
create table customer
(customer_name varchar(20) not null,
customer_street varchar(12) not null,
customer_city varchar(15) not null,
primary key(customer_name));
create table branch
(branch_name varchar(15) not null,
branch_city varchar(15) not null,
balance number not null,
primary key(branch_name));
create table policy
(policy_number varchar(20) not null,
branch_name varchar(15) not null,
premium number not null,
primary key(policy_number));
create table claim
(claim_number varchar(15) not null,
branch_name varchar(15) not null,
amount number not null,
primary key(claim_number));
create table credit
(customer_name varchar(20) not null,
policy_number varchar(20) not null,
primary key(customer_name, policy_number),
foreign key(policy_number) references policy(policy_number),
foreign key(customer_name) references customer(customer_name));
create table debit
(customer_name varchar(20) not null,
claim_number varchar(15) not null,
primary key(customer_name, claim_number),
foreign key(customer_name) references customer(customer_name),
foreign key(claim_number) references claim(claim_number));
2. Populating the tables:
-------------------------
insert into customer values ('Planck','Pyramids','Atlanta');
insert into customer values ('Sommerfeld','Des Jardins', '3 Rivieres');
insert into customer values ('Dirac','Potsdam','New Jersey');
insert into customer values ('De Broglie','Sainte Anne','Toronto');
insert into customer values ('Heisenberg','Mac Donalds','Montreal');
insert into customer values ('Rutherford','Concordia','Paris');
insert into customer values ('Pauli','Des Moines','Sevilla');
insert into customer values ('Born', 'Opera','plattsburgh');
insert into customer values ('Boltzmann','Sherbrooke','Ottawa');
insert into branch values ('1A5', 'Toronto',3456);
insert into branch values ('2A6', 'Atlanta',3456);
insert into branch values ('3A4', 'Montreal', 2347);
insert into branch values ('4D3', 'New Jersey',8765);
insert into branch values ('2B4', 'Montreal',8790);
insert into branch values ('5G5', 'Toronto',3000);
insert into branch values ('7H6', 'Sevilla',4569);
insert into branch values ('7N9', 'Ottawa',3456);
insert into policy values ('11EE', '3A4',2233);
insert into policy values ('23DD', '4D3',4563);
insert into policy values ('34RR', '3A4',2255);
insert into policy values ('66TT', '7H6',439);
insert into policy values ('56NN', '7N9',346);
insert into policy values ('34BB', '5G5',567);
insert into policy values ('49SS', '5G5',2230);
insert into policy values ('90LL', '2B4',556);
insert into claim values ('C2345','2B4',324);
insert into claim values ('C4568','4D3',5643);
insert into claim values ('C8765','2B4',456);
insert into claim values ('C6789','5G5',76);
insert into claim values ('C4589','3A4',345);
insert into claim values ('C4567','7H6',234);
insert into claim values ('C1122','2A6',7890);
insert into claim values ('C5611','7N9',234);
insert into claim values ('C0044','7N9',234);
insert into credit values ('Dirac','34RR');
insert into credit values ('Heisenberg','66TT');
insert into credit values ('Planck','34BB');
insert into credit values ('Sommerfeld','49SS');
insert into credit values ('Born','23DD');
insert into credit values ('Planck','56NN');
insert into credit values ('Dirac','11EE');
insert into debit values ('Planck', 'C6789');
insert into debit values ('Dirac','C2345');
insert into debit values ('Sommerfeld', 'C1122');
insert into debit values ('Dirac','C4589');
insert into debit values ('Pauli','C8765');
insert into debit values ('Dirac','C5611');
insert into debit values ('Rutherford','C4567');
insert into debit values ('Pauli','C0044');
__________________________________________
|
|
|