
create table acc_type (
  acc_code     integer,
  acc_name     char(10)
)\g

insert into acc_type values (
   1, 'loan'
 )\g
insert into acc_type values (
   2, 'savings'
 )\g
insert into acc_type values (
   3, 'checking'
 )\g


create table accounts (
  ssn		char(12),
  acc_code	integer,
  accnum	integer,
  branchnum	integer,
  amount	integer
)\g

insert into accounts values (
 '111-11-1111', 3, 1, 4, 2000
)\g
insert into accounts values (
 '222-22-2222', 3, 2, 3, 500
)\g
insert into accounts values (
 '333-33-3333', 3, 3, 4, 671
)\g
insert into accounts values (
 '444-44-4444', 3, 4, 2, 372
)\g
insert into accounts values (
 '555-55-5555', 3, 5, 1, 4577
)\g
insert into accounts values (
 '666-66-6666', 3, 6, 1, 399
)\g
insert into accounts values (
 '777-77-7777', 3, 7, 2, 2
)\g
insert into accounts values (
 '888-88-8888', 3, 8, 3, 5001
)\g
insert into accounts values (
 '999-99-9999', 3, 9, 5, 699
)\g
insert into accounts values (
 '111-11-1111', 2, 10, 4, 209
)\g
insert into accounts values (
 '333-33-3333', 2, 11, 4, 4311
)\g
insert into accounts values (
 '555-55-5555', 2, 12, 1, 67
)\g
insert into accounts values (
 '999-99-9999', 2, 14, 5, 780
)\g
insert into accounts values (
 '111-11-1111', 1, 15, 4, 1200
)\g
insert into accounts values (
 '333-33-3333', 1, 16, 4, 25
)\g
insert into accounts values (
 '555-55-5555', 1, 17, 1, 1600
)\g
insert into accounts values (
 '121-21-2121', 2, 18, 6, 250
)\g


create table customer (
  ssn           char(12),
  name		char(12),
  addr		char(25),
  city		char(12),
  state		char(4)
) \g


insert into customer values (
 '111-11-1111', 'Louis', '1 Uno Drive', 'Fairfax', 'VA'
)\g
insert into customer values (
 '222-22-2222', 'Duke', '22B Baker St', 'Williamsburg', 'VA'
)\g
insert into customer values (
 '333-33-3333', 'Art', '33 Rolling Rock Way', 'Williamsburg', 'VA'
)\g
insert into customer values (
 '444-44-4444', 'Stan', '44 Magnum Ave', 'Richmond', 'VA'
)\g
insert into customer values (
 '555-55-5555', 'Ella', '5 Pentagon St', 'Williamsburg', 'VA'
)\g
insert into customer values (
 '666-66-6666', 'Charlie', '666 Devils Road', 'Washington', 'DC'
)\g
insert into customer values (
 '777-77-7777', 'Dizzy', '7 Wonder Rd', 'Washington', 'DC'
)\g
insert into customer values (
 '888-88-8888', 'Thelonius', '8 Enough Trail', 'Richmond', 'VA'
)\g
insert into customer values (
 '999-99-9999', 'Sarah', '9 Danke St', 'Williamsburg', 'VA'
)\g
insert into customer values (
 '121-21-2121', 'Benny', '10 Downing St', 'Williamsburg', 'VA'
)\g



create table branch (
  branchnum	integer,
  bname		char(15),
  city		char(12),
  mgrssn	char(12)
)\g

insert into branch values (
 1, 'Monticello', 'Williamsburg', '555-55-5555'
)\g
insert into branch values (
 2, 'Jamestown', 'Williamsburg', '555-55-5555'
)\g
insert into branch values (
 3, 'Ballston', 'Fairfax', '111-11-1111'
)\g
insert into branch values (
 4, 'Capitol', 'Richmond', '100-10-1010'
)\g
insert into branch values (
 5, 'Georgetown', 'Washington', '110-11-1111'
)\g
insert into branch values (
 6, 'Annandale', 'Fairfax', '111-11-1111'
)\g



create table managers (
  ssn		char(12),
  name		char(12),
  addr		char(25),
  city		char(12),
  state		char(4)
)\g


insert into managers values (
 '100-10-1010', 'Ray', '10 Fingers Ave', 'Williamsburg', 'VA'
)\g
insert into managers values (
 '110-11-1111', 'Bud', '11 Apollo St', 'Washington', 'DC'
)\g
insert into managers values (
 '555-55-5555', 'Ella', '5 Pentagon St', 'Williamsburg', 'VA'
)\g
insert into managers values (
 '111-11-1111', 'Louis', '1 Uno Drive', 'Fairfax', 'VA'
)\g


create table cert (
	cert_no	integer,
	certificate	char(15)
)\g


insert into cert values (1, 'BBA')\g
insert into cert values (2, 'MBA')\g
insert into cert values (3, 'DBA')\g
insert into cert values (4, 'CPA')\g
insert into cert values (5, 'Finance')\g
insert into cert values (6, 'Marketing')\g
insert into cert values (7, 'MIS')\g
insert into cert values (8, 'Communication')\g

create table mgr_cert (
	name	char(12),
	cert_no	integer
)\g


insert into mgr_cert values ('Ray', 2)\g
insert into mgr_cert values ('Ray', 4)\g
insert into mgr_cert values ('Ray', 7)\g

insert into mgr_cert values ('Louis', 2)\g
insert into mgr_cert values ('Louis', 4)\g
insert into mgr_cert values ('Louis', 7)\g

insert into mgr_cert values ('Ella', 2)\g
insert into mgr_cert values ('Ella', 4)\g

insert into mgr_cert values ('Bud', 2)\g
insert into mgr_cert values ('Bud', 4)\g
insert into mgr_cert values ('Bud', 7)\g
insert into mgr_cert values ('Bud', 8)\g
