DB Final Project
DB Final Project
“ATM SYSTEM”
Group Members:
Kanza Tanveer(3074)
Alishba Sajid(3035)
When they came into being, ATMs were treated to be a boon for the general public. There was
no need to stand in queues in banks to withdraw money, no need to go the branch for years
even to get a cheque deposited, cash deposited or for getting the cheque book issued.
1. When ATM were first developed there were only few ATM’s and people had to
travel long distance to access ATM.
2. People who were not familiar to the ATM machines they faced a lot of problems for accessing
it.
3. There were many security issues faced before ATM was introduced and after its
introduction some security issues were solved.
4. Some ATMs display the message “Your request cannot be processed now”, the meaning of
which has to be interpreted by the customer only. It can mean that the ATM does not have
sufficient funds, or that your account has some problem, or it may also mean that the server
of the bank is not working.
5. The servers of the banks working so slowly that it is difficult to understand if the problem is
with the machine or the bank’s server.
INTRODUCTION:
Definition of ATM:
History of ATM:
1. Alex Robertson has been credited with developing and building the first automatic teller
machine in USA.
2. The first ATM called Bankograph was installed in Barkley bank in north London on
27,june 1967.
3. After that it was later countries like japan, Sweden, UK credited in developing first cash
machine.
PURPOSE
ATMs are a safe and convenient way to manage your money. There are millions of ATMs
worldwide and you can use many ATMs 24 hours a day, 7 days week. Some allow you to select
the language you want to use. To reduce labor costs for the bank and increase availability of
banking service in a safe and cost effective method. For people who at work themselves when
the banks are open, and can only get there after the banks are closed. It is accurate. Flexible
SCOPE
REQUIREMENTS
Functional requirements:
These requirements are observable tasks or processes that must be performed by the system
under development. For example, functional requirements of an automated teller machine,
Non-Functional requirements:
These requirements are qualities or standards that the system under development must have, or
comply with, but which are not tasks that will be automated by the system.
Scope:
The scope of this project is to allow the users to get access to their account using PIN.
Functionality:
One customer at a time can access their account in ATM machine.
Reliability
The ATM machine must be able to read or scan the card and the PIN properly and
identify the customer account.
Performance:
The ATM machine supports only one customer at a time. The speed and accurate
transaction decides the performance factor. The screen must be clearly visible to the
user.
Security:
The PIN of the card guarantee the security of the customer’s account. The ATM must
not store any of his data in the database. The customer with PIN and a valid card is
allowed to do all transaction.
CASE STUDY:
A bank wishes to introduce ATM. ATM provide limited facilities to customers. Customer may
get ATM card on request. User may view their balance or transfer or withdraw money using
these cards. Cards may be used to access many accounts and an account may be accessed using
different cards.
CREATION OF TABLES:
........................................................................Database.......................................................
create database atmbnksystm
use atmbnksystm
........................................................................accounts.......................................................
create table accounts
(account_number int primary key,
account_type varchar(20),
account_password varchar(30) unique)
........................................................................Atm.....................................................
create table Atm
(atm_id int primary key,
atm_bnak_nmae varchar(30) default 'HABIB BNAK',
atm_address varchar(30) not null,
atm_bank_id int default '1234')
........................................................................bank.....................................................
create table bank
(bank_id int primary key,
bank_name varchar(30) not null,
bank_address varchar(30))
.......................................................................cards.....................................................
create table cards
(card_number int primary key,
card_bank_name varchar(30) default 'HABIB BANK',
card_expiry_date datetime)
........................................................................transactions.....................................................
create table transcations
(transaction_id int primary key,
transaction_type varchar(30))
........................................................................customers.....................................................
create table customers
(customer_id int primary key,
first_name varchar(30) not null,
mid_name varchar(30),
last_name varchar(30),
house_no varchar(10),
street_no int,
city varchar(30),
phone_no int,
customer_cardno int foreign key references cards(card_number),
cutsomer_accountno int foreign key references accounts(account_number))
........................................................................insertion.....................................................
create table insertions
(insertion_no int primary key,
I_atm_id int foreign key references Atm(atm_id),
I_card_number int foreign key references cards(card_number))
........................................................................performs.....................................................
create table performs
(perform_no int primary key,
p_customer_id int foreign key references customers(customer_id),
p_transaction_id int foreign key references transcations(transaction_id))
........................................................................facilitates.....................................................
create table facilitates
(facilite_no int primary key,
f_atm_id int foreign key references Atm(atm_id),
f_customer_id int foreign key references customers(customer_id))
INSERTION:
..................................................................insertion of Accounts.....................................................
insert into accounts
values(12341244,'saving account','alishba'),
(12341245,'current account','lishi'),
(12341457,'current account','neeshi'),
(12341545,'current account','mahrukh'),
(12342563,'current account','lecchi'),
(12343456,'saving account','AL'),
(12345479,'saving account','iru'),
(12345787,'current account','kanza'),
(12345963,'current account','amarah'),
(12346646,'current account','behn'),
(12346643,'current account','teddy')
select * from accounts
........................................................................insertion of Atm.....................................................
insert into Atm(atm_id,atm_address)
values(1203,'grand trunk road Islamabad'),
(1586,'saddar rawalpindi'),
(1596,'central road rawalpindi'),
(5423,'jail road Islamabad'),
(6542,'qasimabad rawalpindi'),
(6656,'railway road Islamabad')
select * from ATM
........................................................................insertion of bank.....................................................
insert into bank
values(1234,'HABIB BANK','ISLAMABAD')
select * from bank
........................................................................insertion of cards.....................................................
insert into cards(card_number,card_bank_name,card_expiry_date)
values(12345678,'Habib Bank','2018-04-14'),
(21045484,'Habib Bank','2018-11-27'),
(34389826,'Habib Bank','2018-09-09'),
(36784360,'Habib Bank','2018-11-09'),
(49739502,'Habib Bank','2018-05-15'),
(51055735,'Habib Bank','2018-07-16'),
(59248025,'Habib Bank','2018-11-04'),
(72907442,'Habib Bank','2018-03-30'),
(73070188,'Habib Bank','2018-02-01'),
(94744228,'Habib Bank','2018-05-14')
select * from cards
.................................................................insertion of customers.....................................................
insert into customers
values(10024883,'Aliyan','khan','butt','d4',16,'Islamabad',32155782,12345678,12346646),
(12012585,'Muhammad','fawad','awan','l10',17,'Abbottabad',34156181,21045484,12341245),
(12035468,'Amir','ali','Tanoli','j8',18,'Islamabad',59612123,49739502,12341244),
(12345780,'Shahid','khan','afridi','b2',34,'Abbottabad',32455240,51055735,12342563),
(12468500,'Azhar','khan','jadoon','h7',41,'Gujrat',32456719,59248025,12345479),
(14478900,'Yousaf','ali','khan','c3',65,'Rawalpindi',234567987,94744228,12345787),
(31424557,'Muhammad','zain','khattak','a1',45,'Islamabad',23459877,36784360,12341545),
(44577895,'Umar','raza','sheikh','e5',62,'Rawalpindi',87654322,34389826,12346643)
select * from customers
insert into
customers(customer_id,first_name,last_name,house_no,street_no,city,phone_no,customer_cardn
o,cutsomer_accountno)
values(1987643,'Amir','jamshad','k5',25,'islamabad',32568795,73070188,12341457)
............................................................insertion of transactions.....................................................
insert into transcations
values(87654,'withdraw'),
(987654,'transfer funds'),
(7654387,'deposit'),
(543234,'bill payment')
select * from transcations
...............................................................insertion of facilitates.....................................................
insert into facilitates
values(1,1203,10024883),
(2,1596,12468500),
(3,1586,10024883),
(4,6656,12035468),
(5,1203,31424557),
(6,5423,44577895),
(7,5423,31424557),
(8,6542,14478900)
select * from facilitates
.................................................................insertion of insertions.....................................................
insert into insertions
values(1,1596,21045484),
(2,1586,36784360),
(3,5423,21045484),
(4,1596,72907442),
(5,6542,49739502),
(6,6656,21045484),
(7,6656,72907442),
(8,1596,94744228)
select * from insertions
............................................................insertion of performs.....................................................
insert into performs
values(1,12345780,987654),
(2,10024883,87654),
(3,14478900,7654387),
(4,12345780,543234),
(5,14478900,987654),
(6,12035468,87654),
(7,12345780,7654387),
(8,12012585,987654)
select * from performs
where p_transaction_id=543234
QUERIES:
...................................................Simple data retrieval queries.....................................................
1) select first_name,mid_name,last_name,house_no,street_no
from customers
where (customer_id=12468500)
........................................................................Update....................................................
update customers
Set first_name='usman'
where customer_id=12345780
.......................................................................Alias.....................................................
...................................................................... OR....................................................................
select p_customer_id,p_transaction_id
from performs
where p_transaction_id=87654 or p_customer_id=14478900
...................................................................... AND...................................................................
select first_name,last_name,mid_name,city,phone_no
from customers
where city='Islamabad' and mid_name='khan'
.......................................................................Between.....................................................................
select atm_id,atm_bnak_nmae,atm_address
from Atm
where atm_id between 1586 and 5423
.......................................................................LIKE.....................................................................
select first_name,city
from customers
where city like'%abad'
select account_number,account_type
from accounts
where account_type like 's%'
....................................................................... NULL.....................................................................
select first_name,mid_name,last_name,city
from customers
where mid_name is null or first_name='Amir'
.......................................................................ALTER.....................................................................
alter table cards
alter column card_expiry_date date
...................................................................... DROP.....................................................................
drop table bank
.......................................................................UNION.....................................................................
select customer_id as id_data, first_name as name
from customers
union
select card_number, card_bank_name
from cards
.......................................................................INTERSECTION......................................................
select p_customer_id
from performs
intersect
select customer_id
from customers
.......................................................................MINIMUM................................................................
SELECT MIN(atm_id) AS atm_data
FROM Atm;
.......................................................................MAXIMUM...............................................................
SELECT MAX(card_number) AS atm_data
FROM cards
.......................................................................COUNT....................................................................
SELECT COUNT(f_customer_id) as facilitate_count
FROM facilitates
WHERE f_customer_id=10024883;
.......................................................................AVERAGE................................................................
....
SELECT AVG(f_customer_id) as facilitate_avg
FROM facilitates
.......................................................................SUM...................................................................
............................................................GROUP BY...................................................................
......................................................................Order by...................................................................
......................................................................EXIST...................................................................
SELECT atm_bnak_nmae,atm_address,atm_id
FROM Atm
WHERE EXISTS (SELECT facilite_no FROM facilitates WHERE f_atm_id = Atm.atm_id
AND facilite_no < 5);
.....................................................................CROSS_JOIN............................................................................
select transcations.transaction_type,customers.first_name,customers.city
from customers
cross join transcations
........................................................................EQUI_JOIN...........................................................................
SELECT *
from customers
join cards
on customers.customer_cardno=cards.card_number
...........................................................................Left_JOIN...........................................................................
SELECT *
FROM customers
LEFT JOIN performs ON customers.customer_id = performs.p_customer_id;
........................................................................Right _JOIN......................................................................
SELECT *
FROM customers
RIGHT outer JOIN cards ON customers.customer_cardno=cards.card_number
--............................................................................INNER_JOIN...........................................
- ...............................................................Describe...................................................................
sp_help cards
.
..........................................................STORE PROCEDURE...........................................................
......................................................................FOR ATM..................................................................
create procedure atm_procedure
as
begin
select atm_bnak_nmae,atm_address
from Atm
where atm_id in(1203,5423,6542)
end
exec atm_procedure
.....................................................................................VIEW............................................................
...
create view customers_data
as
select atm_bnak_nmae,atm_address
from Atm
where atm_id in(1203,5423,6542)
SELECT * FROM customers_data
....................................................................VARIABLE...................................................................
....
declare @ATM_ID INT=5423
select Atm.atm_id
from Atm
where atm_id > @ATM_ID
-
.............................................................FUNCTIONS........................................................................
-.............................................................FOR ATM........................................................................
VARIABLES
declare @a varchar
select customers.first_name
from customers
where first_name like 'F%'