Database - Business Rules
Database - Business Rules
1. Business Rules
Bank
bank_id (PK)
name
Branch
branch_id (PK)
location
operating_hours
bank_id (FK)
Customer
customer_id (PK)
name
address
contact_info
Account
account_number (PK)
type
balance
branch_id (FK)
customer_id (FK)
Transaction
transaction_id (PK)
date
amount
type
account_number (FK)
Relationships:
The schema consists of 5 tables, each representing an entity in the ER model. The
primary key (PK) for each table uniquely identifies a record, while foreign keys
(FK) establish relationships between tables.
4. Table Creation
Here's some example MySQL code to insert data into the tables:
-- Insert a bank
INSERT INTO Bank (name) VALUES ('Global Bank');
-- Insert branches
INSERT INTO Branch (location, operating_hours, bank_id) VALUES ('New York', '9:00 -
17:00', 1);
INSERT INTO Branch (location, operating_hours, bank_id) VALUES ('Los Angeles',
'9:00 - 17:00', 1);
-- Insert a customer
INSERT INTO Customer (name, address, contact_info) VALUES ('John Doe', '123 Main
St, New York, NY', '[email protected]');