Sie sind auf Seite 1von 80

The Relational Database Design/Modeling/Implementation in a RDBMS Software Oracle

SQL Developer and MySQL Workbench

Bank Relational Database

Anthony Beltran
Spring 2016
CS 4332

Submitted to Professor: Dr. C. J. Hwang


Date: 5/4/16

Texas State University

Chapter 1: Introduction
1.1 Motivation
For this project, I chose to implement a system for a bank. The motive behind this decision
was to choose a company in which I would like to learn more about how its database system
works. I also wanted a company that I deal with on a regular basis, and my decision came to be
a bank. Many of my colleagues work in banks as well, and I believe it would be an interesting
choice for me to develop a system and relational database for a bank.

1.2 Project Description


This project begins by introducing the system functional requirements of the bank database.
Interviews are conducted between the database developer and the employees of the bank with
multiple questions in order to generate user requirements. From these interviews, business forms
are created knowing which information is needed for the database.
The project continues by implementing the external schema of the system, as well as the
schema for the user views. This consists of a diagram of the overall system model and how the
users view the system.
A conceptual schema and a logical model is the next step of the system. I describe each
relation and its attributes. I also show each functional dependency and a normalized entity for
that relation. Each entity will provide a primary key and foreign keys if necessary. Then, I show
example tuples in each normalized relation, followed by providing the entire E/R Model diagram
of the system. The E/R Model diagram will have relationships between entities using the
crows feet notation.
The last sections in this project deal with implementing the system with two RDBMS.
The two implementations are done using Oracle SQL Developer and MySQL Workbench. Both
implementations are executed in a graphical user interface. For each of the RDBMS
implementation, I will provide the SQL queries required to create the database. This includes
creating each relation and inserting values. I will also give several English queries with
corresponding SQL queries. Lastly, I will show the output for the implementation of the queries.

Chapter 2: Study of System Functional Requirements


2.1 Introduction
This section provides an interview process between the database developer and several
employees of the company. From these interviews, data is collected to find out which type of
information is needed to implement into the database, as well as the relationships between
employees and the type of information each can view.

2.2 SUMMARY OF INTERVIEWS/STUDY

BANK TELLER
Database Developer: What is your role in the company?
Bank Teller:

I process transactions from customers, receive cash and checks for deposit,
and enter customer transactions into computers.

Database Developer: What kind of data do you work with?


Bank Teller:
Most of the time I am adding customer transactions as well as updating
customer information.
Database Developer: What do you do with the data?
Bank Teller:
I update customer's information such as name, address, and phone
numbers. I will also process transactions.
Database Developer: What reports do you use?
Bank Teller:
I need to be able to search for a customer's account information,
transaction information, and loan information.
LOAN DEPT. SEPCIALIST
Database Developer: What is your role in the company?
Loan Specialist:
I process loan applications and payments for clients as well as work daily
insurance. I also help out with writing monthly reports.
Database Developer: What kind of data do you work with?
Loan Specialist:
I usually am updating and adding loan information for new or existing
clients.
Database Developer: What do you do with the data?
Loan Specialist:
I process new loans for clients along with the interest rate and amount of
the loan. I will also process transactions.
Database Developer: What reports do you use?
Loan Specialist:
I need to be able to search up particular loans and transactions associated
with a particular account. I also need to search up customer information.
DATA PROCESSING SPECIALIST
Database Developer: What is your role in the company?
Data Specialist:
I oversee the functionality of the processing systems and ensure the
accuracy and integrity of the data.
Database Developer: What kind of data do you work with?

Data Specialist:

I am mostly making sure the data is accurate and there is no errors in our
records.

Database Developer: What do you do with the data?


Data Specialist:
I look into mostly all the data, and usually update employee information
with confidentiality, of course.
Database Developer: What reports do you use?
Data Specialist:
I need to be able to search up information on all types of data. I also need
to be able to update employee information.
BRANCH MANAGER
Database Developer: What is your role in the company?
Branch Manager:
I am responsible for employees within the branch, and also address
customers for their satisfaction.
Database Developer: What data do you work with?
Branch Manager:
I am pretty much in charge of everything having to do with my branch. I
need to stay informed on my employees, and customers. I also look into
accounts, loans, and information on persons.
Database Developer: What do you do with the data?
Branch Manager:
I need to be able to update/add/delete my employees' information such as
their salaries and job titles. I also update customer information, account
information, branch information, and transactions.
Database Developer: What reports do you use?
Branch Manager:
I need to search be able to read and search employee, branch, customer,
accounts, and transactions.
PRESIDENT
Database Developer: What is your role in the company?
President:
I oversee all of the activities that take place for this bank.
Database Developer: What data do you work with?
President:
I look into everything in the company, from employee information to all
the bank branches.
Database Developer: What do you do with the data?
President:
I need to be able to have access to add/update/ remove any information
from all areas.

Database Developer: What reports do you use?


President:

I also need to be able to read and search for any information that I may
need.

ASSISTANT MANAGER
Database Developer: What is your role in the company?
Assistant Manager: I help the branch manager by helping oversee branch operations.
Database Developer: What data do you work with?
Assistant Manager: I look into employee information, transactions, customer information, and
accounts.
Database Developer: What do you do with the data?
Assistant Manager: I need access to update employee, customer, accounts, and transactions.
Database Developer: What reports do you use?
Assistant Manager: I need to read employee information and search for customers. I also
search for account and transaction information.

2.3 FUNCTIONAL REQUIREMENTS BUSINESS FORMS


Fig. 2.1: Customer account information

Fig 2.1 shows the form that a customer will have to fill out when setting up a new account with
the bank.

Fig. 2.2: Employee information form

Fig 2.2 shows the form that all Bank employees must fill out in order to save their records into
the database.

Fig. 2.3: New or existing customer forms for loan applications

Fig 2.3 shows the loan application form that a new, or existing, customer must fill out for a loan
from the bank.

2.4 DATA COLLECTION


Fig. 2.4: Filled out customer information form

Fig 2.4 shows a customer information form filled out by customer, Mary Reese, who is setting up
a checkings account with the bank.

Fig. 2.5: Employee information form filled out

Fig. 2.6: Existing bank customer filling out a loan application form

Chapter 3: External Schema (Users Views)


3.1 SYSTEM MODEL DIAGRAM
Fig. 3.1: Overall system model diagram

3.2 USERS VIEW OF SYSTEM

Fig. 3.2: Users view of system.

Chapter 4: Conceptual Schema and Logical Model of the System


4.1 RELATIONS AND ATTRIBUTES DESCRIPTION
Fig. 4.1: Description for the relation Employees

In Fig 4.1, we see the relation of Employees. This relation stores data for each person that is
employed by the bank. The data that is recorded for each employee is their social security
numbers, their salary, the level access, the branch of the bank they are employed in, and the id
for their job title. We will describe the following attributes in more detail:
Attributes

EMPID
o This attribute stores an ID that uniquely defines each individual employee that
works for the bank.
SSN
o This attribute stores the social security number of an employee.
SALARY
o Each employee also has a salary, which is inserted in this attribute.
LEVELACCESS
o This attribute is a security level set for each employee that limits particular
actions each employee is able to do such as approvals, access permissions, etc.
BRANCHID
o This attribute refers to the ID for a particular branch of the bank. Each employee
belongs to a certain branch of the bank.
TITLEID
o This attribute refers to the ID of the job title for the employee.

Fig. 4.2: Description for the relation Branches

Fig 4.2 shows the relation description of Branches. This relation keeps the data for each
individual branch of the bank. Each bank branch has an address and a phone number for
contacting that branch.
Attributes

BRANCHID
o Each branch of the bank is given a unique ID that defines that particular branch.
This attribute stores the ID for a particular branch.
BADDRESS
o This attribute stores the address for each branch of the bank.
PHONE
o This attribute contains the main phone number of contact for that particular
branch.

Fig. 4.3: Description for the relation JobTitle

The JobTitle relation seen in Fig 4.3 keeps data stored for each particular job position in the
bank. Each job position has a unique ID, a name, and a job description of the responsibilities and
duties.
Attributes

TITLEID
o This attribute contains an ID for a particular job position in the bank.
TITLENAME
o This attribute simply contains the name of the job position.
TITLEDESC
o This attribute briefly describes the responsibilities that come with a particular job
position in the bank.

Fig. 4.4: Description for the relation Accounts

Fig 4.4 shows the relation Accounts of the bank database. This relation contains a unique
account for each customer with other information. It shows the account type for each particular
account, as well as the current balance, status, and bank branch associated with it.
Attributes

ACCID
o This attribute is a unique ID given to each bank account.
ACCTYPE
o A customer can open a checking account or a savings account with the bank.
This attribute contains the type of account a particular customer opened.
BALANCE
o This attribute has the current balance for a certain account.
STATUS
o A bank account can be considered open or temporarily closed depending on
certain circumstances. This attribute contains the status that an account can be in.
BRANCHID
o Each account is associated with a certain branch of the bank. This attribute
contains the ID of the branch associated with the account.
CUSTOMERID
o This attribute holds the ID of the customer that the bank account belongs to.

Fig. 4.5: Description for the relation Customers

Fig 4.5 shows the relation that holds a unique ID for each customer of the bank as well as their
social security number.
Attributes

CUSTOMERID
o This attribute contains the unique ID for each customer of the bank.
SSN
o This attribute contains the social security number for every customer.

Fig. 4.6: Description for the relation Persons

The relation Persons is shows in Fig 4.6, and it contains additional information for each
employee and customer. This additional information includes first name, last name, pin number,
address, and phone number.
Attributes

PERSONSID
o This attribute contains a unique ID that identifies the customer or employee in the
relation.
PIN
o Each employee and customer with a bank account has a PIN number that they set
up. This attribute holds the PIN number that allows access to their bank account.
FNAME
o This attribute simply contains the persons first name.
LASTNAME
o This attribute simply contains the persons last name.
ADDRESS
o This attribute has the persons primary address given to the bank.
PHONE
o This attribute has the persons primary phone number.
CUSTOMERID
o This attribute holds the ID associated with a customer of the bank.
EMPID
o This attribute holds the ID associated with an employee of the bank.

Fig. 4.7: Description for the relation Transactions

This relation has information on every transaction of an account associated with the bank. The
transaction information saved includes transaction type, payment type, payment amount, account
associated with the transaction, and the loan ID if applicable.
Attributes

TRANSID
o This attribute is a unique ID for each transaction saved in the relation.
TRANSTYPE
o This attribute contains the type of transaction that was processed. There are
several types of transactions:
Void an approved transaction has been revoked or prevented
Refund a specific amount of money has been returned to an account
Payment a specific amount of money has been charged to an account
LOANID
o This attribute contains a unique ID given to a loan that a customer applied for.
ACCID
o This attribute contains a unique ID that identifies a particular bank account.
PAYMENTTYPE
o A payment can be classified by several types check, credit, and debit.
PAYMENTAMOUNT
o This attribute contains the amount of money that was charged, refunded, or
voided.

Fig. 4.8: Description for the relation Loans

Fig 4.8 shows the Loans relation which stores the data for loans. Each loan has a unique ID as
well as the interest rate and amount.
Attributes

LOANID
o This attribute contains the unique ID associated with a loan.
INTERESTRATE
o Each loan comes with an interest rate, and this attribute contains the interest
associated with that loan.
AMOUNT
o This attribute holds the amount of money that a loan was granted to a person.

Fig. 4.9: Description for the relation Persons

The relation shown in Fig 4.9 shows additional information on a particular transaction type. A
tuple in this relation is composed of a transaction type followed by its description.
Attributes

TRANSTYPE
o This attribute specifies a particular transaction type, such as: payment, refund, or
void.
DESCRIPTION
o This attribute gives additional information on a transaction type.

4.2 FUNCTIONAL DEPENDENCIES AND NORMALIZED ENTITIES


In this section, I will show diagrams showing the functional dependencies within each
relation. Normalized entities with labeled primary and foreign keys will also be shown.
The functional dependency diagrams will consist of a left-hand side with an arrow
pointing to the right-hand side. All attributes on the right-hand side are functionally dependent to
the determinant on the left- hand side.
The normalized entity diagrams will consist of all attributes in the relation listed. The
primary key (P.K.) attribute will be underlined, and the foreign key (F.K.), if any, will be labeled
next to the attribute.

EMPLOYEES

Functional dependencies

Normalized entity

BRANCHES

Functional dependencies

Normalized entity

ACCOUNTS

Functional dependencies

Normalized entity

JOBTITLE

Functional dependencies

Normalized entity

CUSTOMERS

Functional dependencies

Normalized entity

PERSONS

Functional dependencies

Normalized entity

TRANSACTIONS

Functional dependencies

Normalized entity

LOANS

Functional dependencies

Normalized entity

TRANSACTIONTYPES

Functional dependencies

Normalized entity

4.3 EXAMPLE TUPLES FOR NORMALIZED RELATIONS

Now that the relations are normalized and they have primary and foreign keys defined,
we will see example tuples for each relation in the database.

EMPLOYEES
Fig. 4.9: Example tuples for Employees relation

BRANCHES
Fig. 4.10: Example tuples for Branches relation

ACCOUNTS
Fig. 4.11: Example tuples for Accounts relation

JOBTITLE
Fig. 4.12: Example tuples for JobTitle relation

PERSONS
Fig. 4.13: Example tuples for Persons relation

TRANSACTIONS
Fig. 4.14: Example tuples for Transactions relation

LOANS
Fig. 4.15: Example tuples for Loans relation

TRANSACTIONTYPES
Fig. 4.16: Example tuples for TransactionTypes relation

4.4 E/R MODEL (DIAGRAM)

In this section, I will show the ER model of the system. The following entities in the ER
diagram will have relationships using the crows feet notation. All primary keys will be
underlined in each entity, and any foreign keys will be labeled (FK) next to the attribute.

E/R MODEL
Fig. 4.17: ER Model of system

Chapter 5: First RDBMS Implementation Oracle SQL Developer

5.1 SOFTWARE, RDBMS, AND PLATFORM


Several software was used in the implementation of the relational database. First, to
create the external schema (users views), I used the software VP-UML. This software provided
me with the shapes and arrows to show the relationships for the overall system model and users
view of the system. VP-UML was also used to show the functional dependencies.
Next, the E/R Model (Diagram) was implemented using an online diagram software
called draw.io. This site provides diagrams to make flow charts, UML, network and ER
diagrams. The normalized relations (entities) were also shown using draw.io.
I first implemented the relational database using the graphical user interface, Oracle SQL
Developer. In the next section, I will show screenshots of the database creation by showing the
SQL queries for creating the relations and inserting values.

5.2 DATABASE CREATION OF FIRST DBMS


In this section, I will be showing the queries for creating each relation, followed by
inserting values into that relation.

ACCOUNTS

Create relation query

Insert values query

INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)


VALUES ('A022', 'Checkings', '44650', 'open', 'B03', 'C295')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A034', 'Checkings', '67000', 'open', 'B03', 'C128')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A079', 'Savings', '128500', 'open', 'B02', 'C344')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A162', 'Checkings', '56800', 'open', 'B01', 'C251')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A174', 'Checkings', '12600', 'open', 'B01', 'C203')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A199', 'Checkings', '73450', 'temporarily closed', 'B01', 'C234')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A249', 'Checkings', '5500', 'open', 'B03', 'C088')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A253', 'Checkings', '34750', 'open', 'B02', 'C067')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A270', 'Checkings', '2450', 'temporarily closed', 'B03', 'C145')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A300', 'Savings', '89275', 'open', 'B02', 'C198')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A345', 'Savings', '75000', 'open', 'B01', 'C175')
INSERT INTO "HR"."ACCOUNTS" (ACCID, ACCTYPE, BALANCE, STATUS, BRANCHID, CUSTOMERID)
VALUES ('A356', 'Checkings', '900', 'open', 'B02', 'C373')
Commit Successful

BRANCHES

Create relation query

Insert values query

INSERT INTO "HR"."BRANCHES" (BRANCHID, BADDRESS, PHONE)


VALUES ('B01', '4505 Cooperhead Road, New Haven, CT06511', '860-637-8375')
INSERT INTO "HR"."BRANCHES" (BRANCHID, BADDRESS, PHONE)
VALUES ('B02', '2928 White Oak Dr, Overland Park, MO64110', '816-719-9545')
INSERT INTO "HR"."BRANCHES" (BRANCHID, BADDRESS, PHONE)
VALUES ('B03', '870 Gorby Ln, Jackson, MS39213', '601-278-3092')
Commit Successful

CUSTOMERS

Create relation query

Insert values query

INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT
INSERT

INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO
INTO

"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"
"HR"."CUSTOMERS"

Commit Successful

(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,
(CUSTOMERID,

SSN)
SSN)
SSN)
SSN)
SSN)
SSN)
SSN)
SSN)
SSN)
SSN)
SSN)
SSN)

VALUES
VALUES
VALUES
VALUES
VALUES
VALUES
VALUES
VALUES
VALUES
VALUES
VALUES
VALUES

('C067',
('C088',
('C128',
('C145',
('C175',
('C198',
('C203',
('C234',
('C251',
('C295',
('C344',
('C373',

'681-03-7743')
'548-15-3756')
'390-70-5446')
'523-77-4398')
'636-44-8934')
'168-03-2451')
'259-24-1132')
'120-03-5665')
'250-31-1164')
'619-82-4343')
'456-12-9957')
'044-92-0143')

EMPLOYEES

Create relation query

Insert values query

INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)


VALUES ('E004', '274-09-3304', '42000', '5', 'B01', 'T04')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E008', '252-30-7708', '23000', '3', 'B03', 'T89')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E011', '454-42-9039', '63000', '8', 'B02', 'T20')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E016', '766-22-3057', '35500', '4', 'B01', 'T36')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E018', '499-11-4177', '24350', '3', 'B01', 'T89')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E019', '680-38-7025', '34850', '4', 'B02', 'T36')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E021', '529-08-8014', '35000', '4', 'B01', 'T36')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E022', '534-17-3605', '43000', '5', 'B02', 'T04')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E024', '550-03-8312', '57000', '6', 'B01', 'T14')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E030', '268-74-5134', '24500', '3', 'B02', 'T89')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E033', '763-01-9018', '58000', '6', 'B02', 'T14')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E039', '318-20-6307', '25000', '3', 'B02', 'T89')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E040', '263-79-8635', '42500', '5', 'B03', 'T04')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E045', '311-98-6573', '500000', '10', 'B01', 'T56')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E050', '401-25-6064', '57500', '6', 'B03', 'T14')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E051', '039-16-4014', '63500', '8', 'B03', 'T20')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E052', '522-05-2566', '62000', '8', 'B01', 'T20')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E060', '308-28-8124', '35000', '4', 'B03', 'T36')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E066', '605-19-6263', '22750', '3', 'B03', 'T89')
INSERT INTO "HR"."EMPLOYEES" (EMPID, SSN, SALARY, LEVELACCESS, BRANCHID, TITLEID)
VALUES ('E075', '168-64-8712', '24000', '3', 'B01', 'T89')
Commit Successful

JOBTITLE

Create relation query

Insert values query

INSERT INTO "HR"."JOBTITLE" (TITLEID, TITLENAME, TITLEDESC)


VALUES ('T04', 'assistant branch manager', 'assist branch manager with daily
operation, product sales, customer service, supervisory duties')
INSERT INTO "HR"."JOBTITLE" (TITLEID, TITLENAME, TITLEDESC)
VALUES ('T14', 'branch manager', 'responsible for administration and efficient
daily operation of branch, provide leadership, sales management')
INSERT INTO "HR"."JOBTITLE" (TITLEID, TITLENAME, TITLEDESC)
VALUES ('T20', 'data processing specialist', 'oversee system operation functions
of core/host processing systems, ensure accuracy and integrity of data is
maintained')
INSERT INTO "HR"."JOBTITLE" (TITLEID, TITLENAME, TITLEDESC)
VALUES ('T36', 'loan department specialist', 'process loan applications, loan
payments, work daily insurance, monthly reports')
INSERT INTO "HR"."JOBTITLE" (TITLEID, TITLENAME, TITLEDESC)
VALUES ('T56', 'president/CEO', 'responsible for overall services/programs
provided by Bank, attain Bank financial goals, ensure Bank policies')
INSERT INTO "HR"."JOBTITLE" (TITLEID, TITLENAME, TITLEDESC)
VALUES ('T89', 'teller', 'perform customer service duties, accept checking and
savings deposits, process payments, cash/checks withdrawals')
Commit Successful

LOANS

Create relation query

Insert values query

INSERT INTO "HR"."LOANS" (LOANID, INTERESTRATE, AMOUNT)


VALUES ('L011', '0.0798', '3750')
INSERT INTO "HR"."LOANS" (LOANID, INTERESTRATE, AMOUNT)
VALUES ('L023', '0.0549', '5000')
INSERT INTO "HR"."LOANS" (LOANID, INTERESTRATE, AMOUNT)
VALUES ('L062', '0.0643', '6000')
Commit Successful

PERSONS

Create relation query

Insert values query

INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P001', '1663', 'Mary', 'Reese', '1427 Caynor Circle, Newark, NJ 07102', '908-5431663', 'C067')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P002', '1222', 'Marcellus', 'Goodsell', '3476 Penn Street, Van Buren, MO 63965',
'573-323-1222', 'C088')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P003', '8390', 'Carol', 'Carrington', '4128 Pursglove Court, Dayton, OH 45402',
'937-310-8390', 'C128')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P004', '2010', 'Roland', 'Dawson', '1339 Oakwood Avenue, New York, NY 10011',
'212-675-0201', 'C145')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P005', '9591', 'James', 'Yates', '2736 Adamsville Road, Pharr, TX 78577', '956784-9591', 'C175')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P017', '8888', 'David', 'Patterson', '3722 Wilson Av, Farmers Branch, TX 75234',
'972-484-8888', 'C198')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P006', '3457', 'Arthur', 'Kim', '2041 Union St, Seattle, WA 98101', '206-7973457', 'C203')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P007', '1119', 'Ronald', 'Marvin', '1967 Stiles St, Crafton, PA 15205', '412-6134568', 'C234')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P008', '5708', 'Michael', 'Dandridge', '1160 Red Dog Rd, Charlotte, NC 28202',
'704-319-1119', 'C251')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P009', '7408', 'Paul', 'Paxton', '4603 Angus Rd, New York, NY 10016', '212-4545708', 'C295')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P010', '5802', 'Sandy', 'Byrd', '1897 Emily Blvd, San Jose, CA 95134', '831-6007408', 'C344')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, CUSTOMERID)
VALUES ('P011', '2222', 'Caroline', 'Hardy', '1597 Agriculture Ln, Charleston, WV 25301',
'304-989-5802', 'C373')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P013', '7159', 'Rose', 'Daigle', '2963 Heavner Avenue Carrollton, GA 30117',
'770-838-7159', 'E004')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P014', '1234', 'Sandra', 'Shorter', '1887 Rainbow Drive Mansfield, OH 44907',
'330-449-3047', 'E024')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P016', '1977', 'Vincent', 'Nagel', '389 Hall Street Las Vegas, NV 89101', '702553-9728', 'E018')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)

VALUES ('P018', '2456', 'Elizabeth', 'Wortham', '1172 Steve Hunt Road Miami, FL 33138',
'305-758-9325', 'E021')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P019', '1836', 'Donald', 'Jackson', '590 Stuart Street Grove City, PA 16127',
'724-450-1836', 'E008')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P057', '8934', 'Arlette', 'Salley', '3132 Alpha Avenue Plano, TX 75074', '903943-4908', 'E052')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P098', '2910', 'Mel', 'Murphy', '4141 Stratford Park Evansville, IN 47708', '812763-2910', 'E060')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P114', '1989', 'John', 'Reilly', '2149 Chandler Drive Springfield, MO 65806',
'417-726-5439', 'E075')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P123', '4288', 'Glen', 'Garcia', '970 Gladwell Street Collierville, TN 38017',
'901-861-4285', 'E011')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P134', '6665', 'Benita', 'Thomas', '4739 Ventura Drive Salinas, CA 93901', '831263-5553', 'E033')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P146', '3959', 'Bernard', 'Barnes', '2764 Honeysuckle Lane Seattle, WA 98101',
'360-552-8515', 'E045')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P234', '3687', 'Tressie', 'Quezada', '2228 Steele Street Aurora, IL 60504', '630728-3682', 'E019')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P321', '4848', 'Nathan', 'Rowell', '3814 Melm Street Providence, RI 02903', '401237-4841', 'E050')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P345', '3854', 'Sandra', 'Tocco', '1570 White River Way Salt Lake City, UT
84111', '801-478-3951', 'E016')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P347', '1290', 'Holly', 'Drakes', '2932 Oakdale Avenue Tampa, FL 33634', '863578-0582', 'E030')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P456', '5553', 'Dorian', 'Allen', '4787 Goldie Lane Middletown, OH 45044', '513422-4165', 'E022')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P567', '5673', 'Jamie', 'Hanson', '4478 Sand Fork Road Fulton, IN 46975', '574857-7746', 'E039')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P765', '8278', 'Arthur', 'Merrill', '3907 Timberbrook Lane Wray, CO 80758', '970332-8278', 'E051')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P789', '7746', 'Octavia', 'Carpenter', '2798 May Street Lexington, KY 40505',
'606-283-0745', 'E040')
INSERT INTO "HR"."PERSONS" (PERSONSID, PIN, FNAME, LNAME, ADDRESS, PHONE, EMPID)
VALUES ('P890', '2109', 'Ben', 'Walton', '1205 Rainbow Road Los Angeles, CA 90017', '626268-2109', 'E066')
Commit Successful

TRANSACTIONS

Create relation query

Insert values query

INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,


PAYMENTAMOUNT)
VALUES ('J011', 'void', 'A253', 'check', '100')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, LOANID, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J034', 'payment', 'L011', 'A022', 'check', '800')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J043', 'payment', 'A162', 'credit', '75')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J076', 'payment', 'A270', 'debit', '20')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J088', 'refund', 'A345', 'credit', '35')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, LOANID, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J098', 'payment', 'L023', 'A174', 'check', '350')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J099', 'void', 'A356', 'check', '200')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J134', 'payment', 'A034', 'credit', '45')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J150', 'refund', 'A079', 'credit', '50')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J155', 'payment', 'A199', 'debit', '12')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, LOANID, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J177', 'payment', 'L062', 'A300', 'debit', '15')
INSERT INTO "HR"."TRANSACTIONS" (TRANSID, TRANSTYPE, ACCID, PAYMENTTYPE,
PAYMENTAMOUNT)
VALUES ('J211', 'refund', 'A249', 'credit', '30')
Commit Successful

TRANSACTIONTYPES

Create relation query

Insert values query

INSERT INTO "HR"."TRANSACTIONTYPES" (TRANSTYPE, DESCRIPTION)


VALUES ('payment', 'Charged the specified amount to account')
INSERT INTO "HR"."TRANSACTIONTYPES" (TRANSTYPE, DESCRIPTION)
VALUES ('refund', 'Returned the specified amount to account/cardholder''s
account')
INSERT INTO "HR"."TRANSACTIONTYPES" (TRANSTYPE, DESCRIPTION)
VALUES ('void', 'Prevented an approved transaction from being settled')
Commit Successful

5.3 ENGLISH QUERIES AND CORRESPONDING SQL QUERIES


In this section, I come up with multiple queries in English, and I also provide the SQL
queries to implement those English queries.
Query 1:
English statement:
o List all open status accounts

SQL query:
o SELECT *
FROM ACCOUNTS
WHERE status = open;

Query 2:
English statement:
o Give Managers 5% raise

SQL query:
o UPDATE EMPLOYEES
SET SALARY = SALARY * 1.05
WHERE TITLEID IN
(SELECT TITLEID
FROM JOBTITLE
WHERE TITLENAME LIKE %Manager%
OR TITLENAME LIKE %manager%);

Query 3:
English statement:
o List transactions with a credit payment

SQL query:
o SELECT ACCID, TRANSTYPE, PAYMENTTYPE, PAYMENTAMOUNT
FROM TRANSACTIONS
WHERE PAYMENTTYPE = credit
ORDER BY PAYMENTAMOUNT;

Query 4:
English statement:
o List employees in a particular branch

SQL query:
o SELECT FNAME, LNAME, PHONE
FROM PERSONS
WHERE EMPID IN
(SELECT EMPID
FROM EMPLOYEES
WHERE BRANCHID = (SELECT BRANCHID
FROM BRANCHES
WHERE BADDRESS LIKE %Jackson%));

Query 5:
English statement:
o List customers with an account balance lower than $50,000

SQL query:
o SELECT FNAME, LNAME, ADDRESS
FROM PERSONS
WHERE CUSTOMERID IN
(SELECT CUSTOMERID
FROM CUSTOMERS
WHERE CUSTOMERID IN
(SELECT CUSTOMERID
FROM ACCOUNTS
WHERE BALANCE < 50000));

Query 6:
English statement:
o List employees with a level access equal to 3

SQL query:
o SELECT FNAME, LNAME, BRANCHID
FROM EMPLOYEES E, PERSONS P
WHERE E.EMPID = P.EMPID AND LEVELACCESS IN
(SELECT LEVELACCESS
FROM EMPLOYEES
WHERE LEVELACCESS = 3);

Query 7:
English statement:
o Insert a new Employee with the necessary information

SQL query:
o INSERT INTO EMPLOYEES
VALUES (E999, 123-12-1234, 77000, 8, B01, T14);

Query 8:
English statement:
o List all accounts from a particular branch

SQL query:
o SELECT *
FROM ACCOUNTS
WHERE BRANCHID = B02;

Query 9:
English statement:
o List all employees with a salary higher than $70,000

SQL query:
o SELECT *
FROM EMPLOYEES
WHERE SALARY > 70000;

Query 10:
English statement:
o List all loans with an amount greater than $2000

SQL query:
o SELECT LOANID, AMOUNT
FROM LOANS
WHERE AMOUNT > 2000;

5.4 OUTPUT FOR EACH QUERY IMPLEMENTATION

This section will show the output screens for the implementation of each English/SQL
query seen in the previous section. Each screenshot will show the SQL query and an output
result.
Query 1:
List all open status accounts

Query 2:
Give Managers a 5% raise

Query 3:
List transactions with a credit payment

Query 4:
List employees in a particular branch

Query 5:
List customers with an account balance lower than $50,000

Query 6:
List employees with a level access equal to 3

Query 7:
Insert a new Employee with the necessary information

Query 8:
List all accounts from a particular branch

Query 9:
List all employees with a salary higher than $70,000

Query 10:
List all loans with an amount greater than $2000

Chapter 6: Second RDBMS Implementation MySQL Workbench

6.1 SOFTWARE, RDBMS, AND PLATFORM


This section is similar to that of Chapter 5 except that a different DBMS is used to
implement the relational database. Now that weve seen the system implemented with Oracle
SQL Developer, I will show the second implementation.
The second DBMS used to implement the relational database was the graphical user
interface, MySQL Workbench. I will once again display screenshots of the database creation by
showing the SQL queries for creating the relations and inserting values into MySQL Workbench.

6.2 DATABASE CREATION OF FIRST DBMS


In this section, I will be once again showing the queries for creating each relation,
followed by inserting values into that relation. This will all be implemented MySQL
Workbench.

ACCOUNTS

Create relation query

Insert values query

BRANCHES

Create relation query

Insert values query

CUSTOMERS

Create relation query

Insert values query

EMPLOYEES

Create relation query

Insert values query

JOBTITLE

Create relation query

Insert values query

LOANS

Create relation query

Insert values query

PERSONS

Create relation query

Insert values query

TRANSACTIONS

Create relation query

Insert values query

TRANSACTIONTYPES

Create relation query

Insert values query

6.3 ENGLISH QUERIES AND CORRESPONDING SQL QUERIES


In this section, I come up with multiple queries in English, and I also provide the SQL
queries to implement those English queries.
Query 1:
English statement:
o List all open status accounts

SQL query:
o SELECT *
FROM ACCOUNTS
WHERE status = open;

Query 2:
English statement:
o Give Managers 5% raise

SQL query:
o UPDATE EMPLOYEES
SET SALARY = SALARY * 1.05
WHERE TITLEID IN
(SELECT TITLEID
FROM JOBTITLE
WHERE TITLENAME LIKE %Manager%
OR TITLENAME LIKE %manager%);

Query 3:
English statement:
o List transactions with a credit payment

SQL query:
o SELECT ACCID, TRANSTYPE, PAYMENTTYPE, PAYMENTAMOUNT
FROM TRANSACTIONS
WHERE PAYMENTTYPE = credit
ORDER BY PAYMENTAMOUNT;

Query 4:
English statement:
o List employees in a particular branch

SQL query:
o SELECT FNAME, LNAME, PHONE
FROM PERSONS
WHERE EMPID IN
(SELECT EMPID
FROM EMPLOYEES
WHERE BRANCHID = (SELECT BRANCHID
FROM BRANCHES
WHERE BADDRESS LIKE %Jackson%));

Query 5:
English statement:
o List customers with an account balance lower than $50,000

SQL query:
o SELECT FNAME, LNAME, ADDRESS
FROM PERSONS
WHERE CUSTOMERID IN
(SELECT CUSTOMERID
FROM CUSTOMERS
WHERE CUSTOMERID IN
(SELECT CUSTOMERID
FROM ACCOUNTS
WHERE BALANCE < 50000));

Query 6:
English statement:
o List employees with a level access equal to 3

SQL query:
o SELECT FNAME, LNAME, BRANCHID
FROM EMPLOYEES E, PERSONS P
WHERE E.EMPID = P.EMPID AND LEVELACCESS IN
(SELECT LEVELACCESS
FROM EMPLOYEES
WHERE LEVELACCESS = 3);

Query 7:
English statement:
o Insert a new Employee with the necessary information

SQL query:
o INSERT INTO EMPLOYEES
VALUES (E999, 123-12-1234, 77000, 8, B01, T14);

Query 8:
English statement:
o List all accounts from a particular branch

SQL query:
o SELECT *
FROM ACCOUNTS
WHERE BRANCHID = B02;

Query 10:
English statement:
o List all loans with an amount greater than $2000

SQL query:
o SELECT LOANID, AMOUNT
FROM LOANS
WHERE AMOUNT > 2000;

6.4 OUTPUT FOR EACH QUERY IMPLEMENTATION

This section will show the output screens for the implementation of each English/SQL
query seen in the previous section. Each screenshot will show the SQL query and an output
result.
Query 1:
List all open status accounts

Query 2:
Give Managers a 5% raise

Query 3:
List transactions with a credit payment

Query 4:
List employees in a particular branch

Query 5:
List customers with an account balance lower than $50,000

Query 6:
List employees with a level access equal to 3

Query 7:
Insert a new Employee with the necessary information

Query 8:
List all accounts from a particular branch

Query 9:
List all employees with a salary higher than $70,000

Query 10:
List all loans with an amount greater than $2000

Chapter 7: Conclusion
This project began by studying the functional requirements of the system. Interviews
were conducted and data was collected from those interviews. An external schema was designed
of the overall system and users view of the system. A conceptual schema and logical model were
constructed by normalizing relations and developing an E/R Model diagram with relationships of
the system. A database was created by implementing all of the designs and data into two
RDBMSs. Finally, example English queries were conducted and executed by providing the
output of each query.
This project gives me a great amount of insight on how a bank system and relational
database would work. Although not as complex as a big bank, I feel that by implementing this
system I have gained an astonishing amount of knowledge on implementing a relational
database.

Das könnte Ihnen auch gefallen