unique identification number database simulation project report
TRANSCRIPT
November
11, 2014 FINAL_DOCUMENT_2.19
1 | P a g e
DBMS
FINAL SUBMISSION
REPORT (Aadhar Card)
Guided By : Prof. Minal Bhise
PREPARED BY : Team 2.19
Rachit Mishra(201201092)
Deepak Goyal(201201113)
November
11, 2014 FINAL_DOCUMENT_2.19
2 | P a g e
AIM
The aim of this course as we perceived was to get ourselves acquainted
with all the general understandings of how a database actually functions.
Through a series of steps starting from the very basic to a relatively higher
and complex models, we tried to gradually develop our understanding of
the course by doing a case study which was assigned to us. The case study
which we were supposed to work upon was to analyze the role of database
management in the system of UID (Aadhar Card) in our country.
ABSTRACT
Through surveys, questionnaires, interviews and various other modes of
interpretations, we laid out a proper plan involving all possible aspects of
database management in the concern of the aadhar card system.
Accordingly, we integrated these things to our course structure and
analyzed them on various technical concepts, all of which helped us in
creating our database on the system of UID which would be discussed
further in great detail.
November
11, 2014 FINAL_DOCUMENT_2.19
3 | P a g e
INDEX
Table of Contents
1. Software Requirements & Specifications........................................................................................4
1.1 Problem Description..........................................................................................................4
1.2 Requirements Collection...................................................................................................9
1.3 Functionalities...................................................................................................................9
1.3 Module Constraints..........................................................................................................10
1.5 Other relevant information...............................................................................................10
2. ER Diagram....................................................................................................................................17
(Noun Analysis Document - Preliminary table )
3. ER to Relational mapping............................................................................................................. 20
(ER to Relational mapping, Constraints, Normalization, FDD)
4. Normalization Process.................................................................................................................. 20
(ER to Relational mapping, Constraints, Normalization, FDD)
5. DDL Statements/queries/Screenshots/FINAL TABLE/Details of populating................................27
6. JDBC Connection/GUI............................................................................................................55-64
(Functionalities - Authentication, insertion, update, delete)
November
11, 2014 FINAL_DOCUMENT_2.19
4 | P a g e
Software Requirements
Specification
for Aadhar Card
1.1 Problem Description
1.1.1 INTRODUCTION AND OVERVIEW
1. UID or Unique Identification is an initiative initiated by the UIDAI to empower the residents of our nation by providing them a platform to authenticate at any time at any place. 2. UID basically is a 12 digit unique number for every individual in our nation including the newborns and children. On the basis of demographic and biometric data, the UIDAI initiative aims at delivering aadhar card numbers to over 60 crore residents of the country by 2014. 3. To add to the perspective of integrity and nation building, the UIDAI also collaborates with top notch partners across the country to set-up infrastructure which provides convenience to residents. The residents then can authenticate their digital identity. 4. The procedures and measures taken by the UIDAI are robust enough to eliminate the fake IDs and duplicity. Henceforth, UIDs can be verified and authenticated in a very cost effective way. Associated References :
References : Link 1 : http://www.getaheadindia.in/2013/02/aadhar-card-is-important-mandatory-needed-for-future.html
November
11, 2014 FINAL_DOCUMENT_2.19
5 | P a g e
Link 2 : http://www.coolage.in/2013/07/03/why-you-need-a-aadhaar-card/ Link 3 : http://www.slideshare.net/nikhar29/aadhar
November
11, 2014 FINAL_DOCUMENT_2.19
6 | P a g e
1.1.2 MAIN OBJECTIVE OF CASE STUDY : a) PRIMARY OBJECTIVES: The main objective of our case study is to create a database of the people who are the beneficiaries of the Aaadhar Card System. This database would include the biometric data, the demographic data of the people which would be unique for each and every Indian and would help us authenticate our identifications in a better manner. b) ALTERNATE OBJECTIVES : Alternative uses of aadhaar card can be as follows : 1. For opening Bank Accounts, getting pipeline connections, mobile phone connections. 2. While applying for passports, aaadhar cards can prove to be of great significance. 3. Obviously, it will also lead to employment generation. Departments which would be set up for delivering aadhaar cards and carrying out the process of generating UIDs would provide a lot of employment. 4. Security of Nation : The issues of illegal migrants can be heeded and curbed by the concept of UIDs. This is a problem which has troubled the central government a lot. 5. Flexibility on know your resident (KYR) and electronic paperless KYC enabled. Aadhaar card is by far, the simplest identity proof.
References : 1. http://www.myaadhaarcard.in/benefits-of-aadhaar/benefits-of-aadhaar/ 2. http://churumuri.wordpress.com/2011/12/26/nine-reasons-why-we-should-support-aadhaar/
November
11, 2014 FINAL_DOCUMENT_2.19
7 | P a g e
1.1.3 CASE STUDY STORY ( SUMMARY OF RESEARCH ) :
1. India is a huge country with over 1.2 billion of population. As the data in the link 1 suggests, as of 2013, less than 50 million Indians held passports, around 100 million people had PAN cards and just 20 crore people had driving licenses. 2. A large section of our society still has no ID proof. So to resolve this problem of lack of ID proofs throughout the nation, the objective of UID came into picture. 3.The objective of our case study is to study these issues and prepare a database so as to learn more about the prevailing problems. 4.Whenever we migrate to any city, to get a new phone connection, gas pipeline connection, etc. we need an ID proof and since a large section hold no ID, this Aadhar card system is sanctioned by the govt. for all Indians irrespective of caste, creed, societal stature, etc. 5.The poor didn't had the resources like IDs which barred them from availing services like ration cards, bank accounts, etc. So accrediting the poor section is an important specification of development of aadhaar card. References: Link 1 : http://www.myaadhaarcard.in/aadhaar-news/shortage-of-availability-of-aadhaar-database-prior-to-dct-launch/
November
11, 2014 FINAL_DOCUMENT_2.19
8 | P a g e
1.1.4 MODULES A sample of an aadhar card
Different kinds of data modules are required for generating a UID : 1. DEMOGRAPHIC DATA : a) Compulsory data : Which includes name, age/DOB, gender. It also includes the address of residents. b) Conditional Data : Which includes guardian/parent details. c) Optional Data: Which includes phone no. and email address. 2. BIOMETRIC DATA : a) Resident's photograph. b) Resident's finger prints. c) Resident's iris. 3. PROCESS : A) Representation from agencies, academic and industry. B) Standardization on modalities and data formats.
November
11, 2014 FINAL_DOCUMENT_2.19
9 | P a g e
1.1.5 PROCEDURE FOR APPLYING ONLINE/OFFLINE :
All the activities regarding the accomplishment of AADHAAR are done by the planning commission of the Unique Identification Authority of India. The word AADHAAR could be described as the foundation or support, There are few guidelines for applying for Aadhar card. 1. Enrolment for aadhar cards is circulated in the local media and persons have to register there. They will be called for iris of two eyes and biometric impressions of all the fingers are taken and the aadhar card will be issued with in 30 days of time. 2. There is not necessary for the whole family to attend at one time and at one place. Individuals can enrol at any place and time. 3. You can apply through online for Aadhar card. The Government has started issue of Aadhaar Smart Cards for the people online. Download application forms available in English. To proceed with online registration, you need to enter your Ration Card No and get the details before entering family members particulars. 4. If you have downloaded the Aadhaar application for offline submission, you may require to attach these documents or certificates along with printed application form.
References :
Link 1 : http://www.tipsoninterview.in/how-to-apply-for-aadhar-card
November
11, 2014 FINAL_DOCUMENT_2.19
10 | P a g e
1.2 REQUIREMENTS COLLECTION
1.2.1 Our case study basically identifies different types of users and accordingly categorizes
them into categories and relationships which helps us in analyzing about the people who
have enrolled the aadhar card. In this case study, basically we perform the role of a company
or an agency who acts as a middlemen responsible for generating aadhar card for the
citizens of the country.
1.1 User Characteristics ( USER CATEGORIES )
A) Citizen : Uses the fingerprint bio-metric for recognition. He needs to provide with
personal details and his fingerprint images.
B) Operator: The operator is one who enters the demographic details of the citizen
into the computer.
C) Employee : As would be shown in the ER Diagram further, an employee can also
be a category of a user. People can work as an employee and manage work.
1.2 Assumptions :
Both Aadhaar and NPR are based on the unscientific and questionable assumption that there
are parts of human body likes fingerprint, iris, voice etc that does not age, wither and decay
with the passage of time.
Those who support Aadhaar and NPR seem to display unscientific temper by implication. If
in case scanned image of fingerprint distorted, user can again scan their fingerprint.
1.3 FUNCTIONALITIES
1.3.1 Registration/ Enrollments : We need to design a system which would give us a
separate information about the users who have registered for the aadhar card and have got
their registrations successful where as those who have registered for the aadhar and are still
witnessing unsuccessful registrations would be identifies separately. The person can go to
any authorized aadhar enrollment centre in India with his/her ID proof. This makes it easier
to identify the users into separate categories thus making it a functionality.
1.3.2 UPDATION process : Keeping in mind that the system of aadhar card is too hefty
and can be inaccurate at times, sometimes wrong details are entered into the aadhar card
database for a given person, the person is given the opportunity by the UIDAI to UPDATE
his/her database either OFFLINE/ONLINE.
A) Family tree : If there's a new entrant into a family, or if a person in a family
November
11, 2014 FINAL_DOCUMENT_2.19
11 | P a g e
dies and family tree gets altered, the system updates itself automatically. If a woman gets
married, her surname changes, she becomes a part of another family, then she
might have kids. All of this data gets updated into the aadhar card database
1.3.3. Aadhar Card Status : Separate portal for checking out the status of aadhar card has
been put up by the UIDAI. By this means, the person can track his/her processing of the
aadhar card. Accordingly, the person gets notified if the processing is successful, the
aadhar card gets generated, if not, either the generation is under processing or rejected
due to lack of documents or variety of other reasons.
1.4 MODULE CONSTRAINTS
1.4.1 Enrollment Issues: a) Many people who enrolled for aadhar card during the first
phase of enrollment faced the issue of unavailability of aadhar cards. The aadhar card details
were either lost or unusable due to an 'encryption error' . In such cases the enrollment
module on the UIDAI portal ( http://aadharcarduid.com/aadhaar-card-not-received ) enable
the user to re-enroll for the aadhar card under few conditions :
1 ) If the status on their aadhar card says 'Rejected'.
2 ) If the status shows 'not found'.
3) If the status says, cannot be processed due to 'technical reasons'.
b) If the aadhar card status shows rejected due to lack of
availability of documents, the user can still apply for aadhar card even
though there's an enrollment issue. Even if someone in a family does not have individual
valid documents, the resident can still enrol if his/her name exists in family entitlement
document.
In this case the Head of Family in entitlement document needs to be
enrolled first with valid PoI & PoA document.
The head of the household can then introduce other members in the family
while they are enrolling. http://uidai.gov.in/how-to-enroll.html )
1.4.2 DATA UPDATION MODULE : Date of Birth, Residence address, name and gender,
your contact number or any other information which is present in your aadhaar card can be
easily changed if it’s incorrect. Two methods to update data are :
1) Online Method : To update the data online, we need to visit the UIDAI website and use
your mobile number for logging in. You will receive an OTP number on your cellphone
November
11, 2014 FINAL_DOCUMENT_2.19
12 | P a g e
which will help you to proceed further.
1.1 ) Log in.
1.2 ) Upload Documents
1.3 ) Select BPO service provider and submit request.
2) Offline Method :
2.1 ) Download the correction form from the UIDAI website.
2.2) Fill the form with self attested photocopies and give a working mobile number.
2.3) Post the form in an envelope.
Reference : http://aadhaarcarduid.org/how-to-update-change-your-aadhar-details/
1.4.3) CURRENT STATUS : To check the status of aadhar card, we need to visit the portal,
give the enrollment ID and enter the security code.
By this way, we can track the status of our aadhar card.
1.5 OTHER RELEVANT INFORMATION
1.5.1 FACT FINDING CHART :
This fact finding chart basically contains a tabled list of the tasks we performed, the
subjects over which we performed the tasks and studied them and the resources we used in
order to facilitate our study over those subjects.
Sr. No. Objective Techniques Subject Time
Commitment
1. To get
background on
the system of
aadhar card and
the UIDAI
Background
readings
Online data and
resources on the
system of aadhar
card
1 hour
2. To identify the
scope of the
aadhar card
system
Interview A member pf
aadhar card
committe
1 hour
3. To take a note of
all the online
resources and
Background
reading
UID authority of
india
30 min
November
11, 2014 FINAL_DOCUMENT_2.19
13 | P a g e
material on
aadhar card
4. To interrogate
people about the
system of aadhar
card
Survey, Online
questionnaires
Students,
Employees
2-3 hours
5. Research on how
to track an
aadhar card
Online portal Citizens, general
publoc
30 min
1.5.2 Questionnaire/Interviews :
Keeping in mind the advantages of the UID system and the complexities it can cause, we prepared a
questionnaire for a general public to take a note about their awareness of the UID and there
suggestions, advises or criticism on the same. We tried to include a variety of questions in the
questionnaire, questions ranging from whether they had an Aadhar Card to whether they were about
schemes like KYC(Know Your Client) which are triggered by UID. Questions we asked are divided
into various subtopics below :
5.1 Are you aware about the system of UID initiated by the government of India?
This was the most basic question which demanded to be asked. It's very much necessary for people
to be aware about the system of UID in order to avail benefits from the same or criticize it.
Awareness about UID is something which is needed even if you don't support the concept of Aadhar
Card. Maybe, you can suggest changes. So we felt the need to ask this question.
5.2 Do you have a UID? If yes, are you aware about the benefits of UID?
In today's India, there's quite a possibility that a person might possess an Aadhar Card and still be
unaware about the benefits. It happens a lot. Possibly because the government and the UIDAI
themselves haven't laid out the benefits an Aadhar Card can hold for a citizen in a transparent
manner on a national platform.
5.3 Do you think that the system of UID is indirectly a security breach in the lives of
concerned citizens?
There are arguments which pop up in public forum like Aadhar Card infringes on our right to
fundamental privacy. Linking of the Aadhaar number with food security under the new Act, LPG
subsidy, the Employees’ Provident Fund and other direct transfer of benefits made enrolment under
the Aadhaar scheme mandatory, falsifying the government’s claim that it was voluntary. So this is
an essential argument over which we thought the views of a general public would be if great help.
November
11, 2014 FINAL_DOCUMENT_2.19
14 | P a g e
5.4 What do you think are the alternative benefits of UID?
We wanted to check if people were aware of other benefits of UID apart from acting as an unique
ID. Benefits like the UID can help while getting a passport, while getting a gas connection, while
getting a telephone connection, a ration card, etc. So we asked this.
5.5 What are the improvements you suggest in the present system of Aadhar Card?
A general question to consider views from people about what changes if any they could or would
suggest in the current system of Aadhar Card(UID).
5.6 Are you aware about the KYC scheme by the government which is triggered by the UID system?
To distinguish the well aware class from a little bit unaware class, we asked this question. This
question was a bit too deep but we thought it was necessary to check out if few of them people were
literally aware about the KYC approach.
5.7 Do you think that the concept of UID would benefit those who migrate constantly from
one state to another and face difficulty getting a new pipeline connection, a new telephone
connection, etc.?
This question is actually a fact. By giving the fact that UIDs can benefit people who are into
constant migration to get pipeline connections, phone connections, etc. easily we wanted to see if
there are people who can disagree with a fact.
So we prepared a total of seven questions. We tried to include all about the domain of UID in this
survey form we prepared which helped us in preparing these seven to-the-point questions. We
received sufficient responses to analyse our survey in a more concrete manner. The responses are
discussed in the next section.
November
11, 2014 FINAL_DOCUMENT_2.19
15 | P a g e
6.Observations:
We received a total of 53 responses to our survey form over a period of 3 days.
6.1 Are you aware about the system of UID initiated by the government of India?
Observation: Over 95% of people who took the survey were aware about the system of Aadhar Card
initiated by the UIDAI. Awareness on such a large scale is always a positive factor because it helps
you to identify and interpret things.
6.2 Do you have a UID? If yes, are you aware about the benefits of UID?
November
11, 2014 FINAL_DOCUMENT_2.19
16 | P a g e
Observation : Approximately, about 20% of people didn't had aadhar cards. To much surprise, about
40 percent of those possessing aadhar cards weren't aware about the benefits of aadhar cards they
were holding where as 45 percent were aware about the benefits of aadhar and they also had one.
6.3 Do you think that the system of UID is indirectly a security breach in the lives of
concerned citizens?
As we told above, in the questionnaire section, this is much debated topic. Thus, we almost got an
equal number of votes to both the answers. Some people think that it's a security breach where as
some don't, fair enough.
6.4 What do you think are the alternative benefits of UID?
People had different answers like :
We can identify a person using their retina scan or their fingerprints.
A single card serves all purposes.
People won't be questioned for their authenticity.
Benefits in passports, ration, gas pipelines.
A unique number would lead to a better public distribution system.
Keeps a track of all the citizens so it can be advantageous for national security.
November
11, 2014 FINAL_DOCUMENT_2.19
17 | P a g e
6.5 What are the improvements you suggest in the present system of Aadhar Card?
Some people suggested that Aadhar Card should be used as a voting card too. It'll then
be a huge benefit.
Inclusion of public libraries.
To keep a check of activities of citizens.
Expansion of this scheme to rural areas too.
It should be made a standard proof of identification and for other purposes.
6.6 Are you aware about the KYC scheme by the government which is triggered by the UID
system?
About 60 percent of people were unaware about the KYC approach implemented by our
government. This KYC(Know Your Citizen) approach can be triggered by UID. This question was
just to test the in depth awareness of a certain section of public regardless of whether they owned
aadhar cards or not.
6.7 Do you think that the concept of UID would benefit those who migrate constantly from
one state to another and face difficulty getting a new pipeline connection, a new telephone
connection, etc.?
November
11, 2014 FINAL_DOCUMENT_2.19
19 | P a g e
NOUN ANALYSIS DOCUMENT ( A PRELIMINARY TABLE )
INTRODUCTION : This noun analysis document aims at sorting all the nouns out of
the SRS document which we created in the previous lab. Based on the analysis, we
would be rejecting some nouns and keeping the others. Our method of keeping and
rejecting the nouns would be based on the following classification of nouns :
To analyze the list of the nouns & reject those that are unsuitable for use as the basis
for entities.
Duplicates: if two or more nouns are simply names for the same thing, then only one
of these should be used as the basis for an entity
Irrelevant : entities which exist in the problem domain but which are not part of the
intended system should also be discarded
Sr. No. Candidate Entity Candidate Attribute Candidate
Relationship Set
1. Aadhar Card, Citizen Aadhar Card – UID,
bio-metric data, gender,
address
Citizen - citizen_name,
Address, id
enroll
( under at-most one
constraint )
2. Bank Account, UID
beneficiaries
Bank Account –
Account number,
Account holder's name
UID Beneficiaries –
Name, Address,
Contact no., ration card
no.
Holds
Attribute : Year end
process, fund group
3. Operator, User Operator –
Operator_id,
Manage
November
11, 2014 FINAL_DOCUMENT_2.19
20 | P a g e
Sr. No. Candidate Entity Candidate Attribute Candidate
Relationship Set
Operator_name
citizen – id, address,
citizen_name
4. Questionnaire, Aadhar
Card
Questionnaire – Text,
Multiple. Paragraph
Aadhar Card – UID,
Name, Gender, PAN
number
Awareness
5. UID features, People UID features – LPG
subsidy, ration card,
PAN Number
People – UID, address,
Name
benefits
6. UID, Social Security UID – ID
Social Security – bank
account, Gas
connection
Breaches
7. Authentication service
agency (ASA),
Authentication User
Agency (AUA),
AUA – Users
ASA – Server
processing speed,
HTTPS Protocol
interfaces
REJECTED NOUNS : We rejected a few nouns,
To study the list of the nouns & reject those unsuitable for use as the basis for entities.
• Duplicates: if two or more nouns are simply names for the same thing, then only
one of these should be used as the basis for an entity
• Irrelevant: entities which exist in the problem domain but which are not part of
the intended system should also be discarded
• Vague: When considering words carefully it sometimes become clear that they do
not have a precise meaning and cannot be a basis for useful entity in the system
• General: Some words are too general
• Attributes: Some words we want to keep as a part of some entity and not an
entity itself
November
11, 2014 FINAL_DOCUMENT_2.19
21 | P a g e
• Associations: some words actually represent a relationship between entities
Sr. No. Rejected Noun Reason For Rejecting
1. Society Vague/General
2. Country Vague/General
3. Database Too common ( Vague Noun )
4. Biometric Duplicate Noun
5. Demographic Duplicate Noun
6. Education General
7. Health General
3. ALL IN ONE
In this section, ER To relational mapping the DDL Statements, constraints(Primary Key, foreign key, etc.), normalizing the entities and the relationships, everything has been done.
This section shows the functional dependencies, anomalies(update, insert and delete)
1. For citizen, a table named citizen with attributes ID, Name and Address passed as
parameters :
create table citizen(id int, citizen_name varchar, address varchar, Primary Key(id));
NORMALIZATION : Update anomaly : no update anomaly
DELETE and INSERT anomaly also won't affect the entity
THIS IS IN 1NF
For our convenience we have broken the table into,
citizen1(id,uid) AND
citizen2(id, citizen_name, address)
For 2NF, we check to remove all partial dependencies. Since there's no partial
dependency, it's already in 2NF. Similarly, it's already in 3NF and BCNF
November
11, 2014 FINAL_DOCUMENT_2.19
22 | P a g e
2. For the status of aadhar card,
create table status(enrollment_id int, dated Date, Primary
Key(enrollment_id));
Note : Update anomaly : Time implies date.
Delete/ Insert anomaly : Cannot insert time or date unless a new Enrollment
ID is assigned to it.
1NF - yes
2NF - Since time implies date, we break the status into status(time , date)
and status(Enrollment_ID, time)
3NF - For 3NF, we need to check for transitive dependencies(attribute-
attribute dependencies). Here, none exist so we move ahead.
3. Another entity to be represented in the form of a table would be Aadhar Card
DDL Statement :
create table Aadhar_Card(uid int, gender varchar, address varchar,
biometric_data varchar, Primary Key(uid));
NORMALIZED : Update anomaly : Biomertric data implies Address, UID implies
biomertric.
Delete/Insert anomaly : Unless biomertric data is inserted, cannot
get a UID
1NF - yes
2NF - Aadhar_Card(UID int, Gender varchar, Address varchar,
bio-metric_data varchar, Primary Key(UID) TO
Aadhar_card1(uid, Biometric_data)
Aadhar_card2(uid int, gender varchar,address varchar, Primary
Key(UID))
4. For Location,
create table Location(pin_code int, location_name varchar, Primary
Key(pin_code));
Note : Update anomaly : PIN CODE implies NAME.
delete/insert anomaly : Unless PIN CODE is inserted, cannot get the
November
11, 2014 FINAL_DOCUMENT_2.19
23 | P a g e
location's name.
TABLE DECOMPOSES TO ( AFTER NORMALIZING )
Location1(pin_code, location_name)
We stop at 2NF, further decomposition not possible.
5. For Duration,
create table Duration(begin_date date, end_date date, Primary Key(begin_date));
Note : Update anomaly : begin_date implies end_date. If i update
begin_date, need to update end_date
Insert anomaly : Can't find end_date unless we have begit_date .
Already in 1NF. For 2NF, Duration(begin_date, end_date)
6. For the operator,
create table operator(employee_id int, operator_name varchar)
Note : No anomalies
THE FUNCTIONAL DEPENDENCY DIAGRAM :
November
11, 2014 FINAL_DOCUMENT_2.19
24 | P a g e
Now, coming over to the relationships the first relationship we encounter is
register_for_aadhar
create table register_for_aadhar(
pin_code int not null,
ID int null,
successful varchar,
Primary Key(pin_code, ID),
foreign key(ID)
references citizen,
foreign key(pin_code)
references location);
Note : There won't be any update anomaly.
Insert anomaly : Unless i insert, location or ID, can't get
successful/unsuccessful
Normalization : 1. Already in 1 NF
2. No partial dependencies so WE STOP at 1 NF. The table is already normalized
November
11, 2014 FINAL_DOCUMENT_2.19
25 | P a g e
2. enroll
create table enroll(
ID int not null,
Enrollment_ID int not null,
UID int not null,
foreign key(ID)
references citizen,
foreign key(Enrollment_ID)
references status,
foreign key(UID)
references Aadhar_Card);
Note : Update anomaly : Enrollment ID implies UID, UID implies ID
Insert anomaly : We don't have a UID unless we have an enrollment
ID.
Normalization : a) Already in 1 NF
b) For 2NF , since enrollment_id implies UID, we decompose enroll into
enrol1l(enrollment_id, UID) and
enroll2(UID, ID)
Further decomposition not possible.
3. member_of_family
create table member_of_family(
ration_card_id int not null,
UID int not null,
ID int not null,
primary key(ration_card_id, UID, ID),
foreign key(ration_card_id)
references family,
foreign key(UID)
references Aadhar_Card,
foreign key(ID)
references citizen);
Update anomalies : UID implies ID. If a tuple of ID is updated , we
need to update the corresponding data for ration card too .
Insert anomalies : We don't have an ID unless we have a UID
November
11, 2014 FINAL_DOCUMENT_2.19
26 | P a g e
Normalization : 1) IN 1NF
2) For 2NF, we create
member_of_family(UID, ration_card_ID) and
member_of_family1(UID, ration_card_id)
We stop at 2nf.
4. update
create table update(
ID int not null,
UID int not null,
ration_card_id int not null,
uploaded_ documents varchar,
primary key(ID, UID, ration_card_id),
foreign key(ID)
references citizen,
foreign key(UID)
references Aadhar_Card,
foreign key(ration_card_id)
references family);
INSERT ANOMALIES : UID implies ID. If a tuple of UID is updated, we
need to update the corresponding ID, ration_card_id, uploaded documents too.
UPDATE ANOMALIES : We don't have an ID unless we insert a UID.
For NORMALIZATION, we decompose,
update1(UID, ID) and
update2(UID, ration_card_id,uploaded_documents)
This is the most normalized form so we stop at 2NF
5. works_as
create table works_as(
ID int not null,
employee_ID int not null,
November
11, 2014 FINAL_DOCUMENT_2.19
27 | P a g e
primary key(ID, employee_ID),
foreign key(ID)
references citizen,
foreign key(employee_ID)
references operator);
Update anomalies : Employee_ID implies ID. If i update a tuple of employee_id,
the corresponding values of ID also need to be updated .
Insert anomalies : We don't have an ID unless we have an Employee_ID
Straight away moving to 2NF for normalization, we create
works_as1(Employee_ID, id)
We stop at 2nf. Further normalization not possible.
6. manage
create table manage(
demographic_details varchar not null,
employee_ID int not null,
UID int not null;
primary key(employee_ID, UID),
foreign key(employee_ID)
references operator,
foreign key(UID)
references Aadhar_Card);
Update anomalies : Employee_ID determines UID. If i update a
value of Employee_ID in a tuple, the corresponding values of demographic_details and UID also
need to be updated.
Insert anomalies : Cannot insert UID without inserting an
Employee_ID and demographic_details.
For 2nf, manage1(employee_id, uid)
manage2(uid, demographic details)
November
11, 2014 FINAL_DOCUMENT_2.19
28 | P a g e
4. DDL STATEMENTS QUERIES/SNAPSHOTS
After completing the normalization process till 3NF/BCNF, we moved on
to writing and executing the queries in postgres. We wrote a total of 30
queries and we tried to cover a range of queries, i.e nested queries,
multiple nested queries, GROUP BY queries and various other types too.
LIST OF ALL TABLES :
November
11, 2014 FINAL_DOCUMENT_2.19
29 | P a g e
Details of populating the tables : We populated every table with 100 rows using a random generator. We used an online generator( datagenerator.net to populate the data)
November
11, 2014 FINAL_DOCUMENT_2.19
30 | P a g e
DBMS QUERIES
query-1; Get all pincodes for locations in UTTAR PRADESH
select l.pin_code
from location l
where l.location_name='Uttar Pradesh'
query-2 Get all uid for females with address Ap #566-2715 Tellus. Ave
select l.uid
from aadhar_card2 l
November
11, 2014 FINAL_DOCUMENT_2.19
31 | P a g e
where l.gender='F' and l.address='Ap #566-2715 Tellus. Ave'
query-3:get all enrollment_id on the date of 2012-10-31.
select l.enrollment_id
from status l
where l.dated='2012-10-31'
November
11, 2014 FINAL_DOCUMENT_2.19
32 | P a g e
query-4:Get addresses of all citizens having UID greater than 180.
select c2.address
from citizen2 c2, citizen1 c1
where c2.id=c1.id AND c1.uid>180
November
11, 2014 FINAL_DOCUMENT_2.19
33 | P a g e
query-5:get all uid of mothers in families:
select mf.uid
from member_of_family mf
where mf.ration_card_id in (select f.ration_card_id
from family f
where f.relation='Mother'
)
query-6:get all uid for male gender
select a2.uid
from aadhar_card2 a2
where a2.gender='M'
November
11, 2014 FINAL_DOCUMENT_2.19
34 | P a g e
query-7: Get distinct addresses for all males who have an aadhar card(UID)
select count(distinct a2.address)
from aadhar_card2 a2, citizen1 c1
where c1.uid=a2.uid AND
a2.gender='M'
QUERY 8 : Find the names of OPERATORS who MANAGE EMPLOYEES who are CITIZENS
with UIDs greater than 185.
select op.operator_name
from operator op
where op.employee_id in
(select man.employee_id
November
11, 2014 FINAL_DOCUMENT_2.19
35 | P a g e
from manage man
where man.employee_id = op.employee_id AND
man.uid in
(select c1.uid
from citizen1 c1, manage man
where c1.uid=man.uid AND
c1.uid > 185 ))
query-9 : List down all pin codes in maharashtra where the registrations for
aadhar card were successful, also list down the corresponding uid which were
successfully registered
select lo.pin_code
from location lo
where lo.location_name = 'Maharashtra' AND
lo.pin_code in ( select lo.pin_code
from register_for_aadhar rfa, location lo
where lo.pin_code = rfa.pin_code AND
rfa.successful = 'YES' )
November
11, 2014 FINAL_DOCUMENT_2.19
36 | P a g e
query - 10 : Number of distinct names of citizens who need to update data
and who have UPLOADED THE DOCUMENTS.
select count (distinct c2.citizen_name)
from citizen2 c2, update1 up1
where c2.id=up1.id AND
up1.uid in ( select up.uid
from update up, update1 up1
where up.uid=up1.uid AND
up.uploaded_documents= 'HAS' )
November
11, 2014 FINAL_DOCUMENT_2.19
37 | P a g e
query - 11 : List down addresses of all citizens whose name starts with 'A'
and who work as an employee.
select c2.address
from citizen2 c2, works_as wa
where c2.id=wa.id AND
c2.citizen_name LIKE 'A_%'
November
11, 2014 FINAL_DOCUMENT_2.19
38 | P a g e
query 12 : Mention the demographic details of all the mothers who have a
UID(in a family)
select m1.demographic_details
from manage1 m1, member_of_family mof
where m1.uid=mof.uid AND
mof.ration_card_id in ( select fam.ration_card_id
from family fam, member_of_family mof
where fam.ration_card_id=mof.ration_card_id AND
November
11, 2014 FINAL_DOCUMENT_2.19
39 | P a g e
fam.relation='Mother' )
Query 13 : For all ENROLLEES named 'Aretha', find the DATE on which the
STATUS was enquired.
select st.dated
from status st, enroll1 e1
where st.enrollment_id = e1.enrollment_id AND
e1.uid in ( select C1.UID
from citizen1 c1, enroll1 e1
where c1.uid = e1.uid AND
c1.id in ( select c2.id
from citizen2 c2
where c1.id = c2.id AND
November
11, 2014 FINAL_DOCUMENT_2.19
40 | P a g e
c2.citizen_name = 'Aretha' ) )
Query 14: Find the names of all operators who work as employees in the
location of MAHARASHTRA.
select op.operator_name
from operator op, works_as wa
where op.employee_id=wa.employee_id
AND wa.id in ( select rfa.id
from register_for_aadhar rfa, works_as wa
where rfa.id = wa.id AND
rfa.pin_code in
( select lo.pin_code
from location lo, register_for_aadhar rfa
where lo.pin_code = rfa.pin_code AND
lo.location_name = 'Maharashtra'
) )
November
11, 2014 FINAL_DOCUMENT_2.19
41 | P a g e
Query 15: Find the names of all the fathers in a family who have a UID .
select distinct(c2.citizen_name)
from citizen2 c2, citizen1 c1
where c2.id=c1.id AND
c1.uid in ( select ac2.uid
from aadhar_card2 ac2, citizen1 c1
where ac2.uid=c1.uid AND
ac2.gender='M' AND
ac2.uid in ( select mof.uid
from member_of_family mof, aadhar_card2 ac2
where mof.uid=ac2.uid AND
mof.ration_card_id in ( select fam.ration_card_id
from family fam, member_of_family mof
where fam.ration_card_id = mof.ration_card_id AND
fam.relation='Father' )))
November
11, 2014 FINAL_DOCUMENT_2.19
42 | P a g e
query 16: List down UIDs of all citizens living at '121-1451 Nunc. Rd.' who
have SUCCESSFULLY registered for aadhar.
select c1.uid
from citizen1 c1, register_for_aadhar rfa
where c1.id = rfa.id AND
rfa.successful='YES' AND
c1.id in ( select c2.id
from citizen2 c2, citizen1 c1
where c2.id = c1.id AND
c2.address='121-1451 Nunc Rd.' )
November
11, 2014 FINAL_DOCUMENT_2.19
43 | P a g e
Query 17: Count the number of people who have enrolled for an update in the
UID details and have UPLOADED the uploaded_documents.
select count(up.uploaded_documents)
from update up, enroll1 e1
where up.uid=e1.uid AND
up.uploaded_documents='HAS'
Query 18: Find the UIDs of all citizens whose UID is GREATER THAN the UID of
some citizen named 'Noelani'
November
11, 2014 FINAL_DOCUMENT_2.19
44 | P a g e
select c1.id
from citizen1 c1
where c1.id > ANY ( select c2.id
from citizen2 c2
where c2.citizen_name = 'Noelani' )
Query 19 : Count the number of citizens with UIDs who work as employees and
who have uploaded the documents for updation process.
select count(up.uploaded_documents)
from update up, citizen1 c1
where up.uid = c1.uid AND
up.uploaded_documents='HAS' AND
c1.id in ( select wa.id
from works_as wa, citizen1 c1
where wa.id = c1.id AND
wa.employee_id> 485 )
November
11, 2014 FINAL_DOCUMENT_2.19
45 | P a g e
Query 20 : Find the addresses of citizens who have enrolled for their UID's
STATUS enquiry on '2012-11-14' .
select c2.address
from citizen2 c2, citizen1 c1, enroll1 e1
where c2.id = c1.id AND
c1.uid = e1.uid AND
e1.enrollment_id in ( select st.enrollment_id
from status st, enroll1 e1
where st.enrollment_id=e1.enrollment_id AND
st.dated= '2012-11-14' )
November
11, 2014 FINAL_DOCUMENT_2.19
46 | P a g e
Query 21 : Find the RELATIONS of all citizens having names of the form
'A____a' with their families who have uploaded the documents for the process
of UPDATE.
select fam.relation
from family fam, update up, citizen1 c1
where fam.ration_card_id = up.ration_card_id AND
up.uploaded_documents='HAS' AND
up.uid = c1.uid AND
c1.id in ( select c2.id
from citizen2 c2
where c2.citizen_name LIKE 'A%_a' )
November
11, 2014 FINAL_DOCUMENT_2.19
47 | P a g e
Query 22 : Find whether a person who has applied for the UPDATE process on
'2012-08-28' HAS successfully registered for aadhar or not.
select rfa.successful
from register_for_aadhar rfa, update1 up1
where rfa.id=up1.id AND
up1.uid IN ( select e1.uid
from enroll1 e1, status st
where e1.enrollment_id = st.enrollment_id AND
st.dated='2012-08-28' )
November
11, 2014 FINAL_DOCUMENT_2.19
48 | P a g e
Query 23 : For all UIDs greater than 100, find the least UID corresponding
to both the genders.
SELECT ac2.gender, MIN(ac2.uid) AS minUid
FROM aadhar_card2 ac2
WHERE ac2.uid>100
GROUP BY ac2.gender
HAVING COUNT(*)>1
November
11, 2014 FINAL_DOCUMENT_2.19
49 | P a g e
Query 24: Count the number of NAMES of all the MALE citizens with UIDs
SELECT c2.citizen_name, COUNT(*) AS namecount
FROM citizen2 c2, citizen1 c1, aadhar_card2 ac2
WHERE c2.id = c1.id AND c1.uid = ac2.uid AND ac2.gender='M'
GROUP BY c2.citizen_name
November
11, 2014 FINAL_DOCUMENT_2.19
50 | P a g e
Query 25: For all IDs greater than 90 group down all citizen names
corresponding to those IDs which appear at least thrice in the whole list.
SELECT c2.citizen_name, MIN(c2.id) AS minId
FROM citizen2 c2
WHERE c2.id>90
GROUP BY c2.citizen_name
HAVING 3 < ( select count(*)
FROM citizen2 c3
WHERE c2.citizen_name = c3.citizen_name )
November
11, 2014 FINAL_DOCUMENT_2.19
51 | P a g e
Query 26 :
Find all the locations with pin codes greater than 500 where all the people
having a name starting with 'A' have successfully registered for aadhar.
SELECT lo.location_name
FROM location lo, register_for_aadhar rfa
WHERE lo.pin_code = rfa.pin_code AND
lo.pin_code > 500 AND
rfa.successful = 'YES' AND
rfa.id in ( select c2.id
from citizen2 c2, register_for_aadhar rfa
where c2.id=rfa.id AND
c2.citizen_name LIKE 'A_%' )
November
11, 2014 FINAL_DOCUMENT_2.19
52 | P a g e
Query 27: Retrieve the names of the operators who work as employees and are
related to their families as being a SON.
select op.operator_name
from operator op, works_as wa
where op.employee_id = wa.employee_id AND
wa.id in ( select mof1.id
from member_of_family1 mof1, works_as wa
where mof1.id=wa.id AND
mof1.uid in ( select mof.uid
from member_of_family mof, member_of_family1 mof1
where mof.uid = mof1.uid AND
mof.ration_card_id in ( select
fam.ration_card_id
from family fam,
member_of_family mof
where fam.ration_card_id =
mof.ration_card_id AND
November
11, 2014 FINAL_DOCUMENT_2.19
53 | P a g e
fam.relation = 'Son' )))
Query 28: Find the addresses of citizens possessing a UID, with demographic
details > 610 and managed as employees by an operator named 'Serina' .
select c2.address
from citizen2 c2, citizen1 c1
where c2.id = c1.id AND
c1.uid in ( select man1.uid
from manage1 man1, citizen1 c1
where man1.uid = c1.uid AND
man1.demographic_details>610 AND
man1.uid in (select man.uid
from manage man, manage1 man1
where man.uid = man1.uid AND
man.employee_id in ( select
op.employee_id
from operator op,
manage man
where
op.employee_id = man.employee_id AND
operator_name =
'Serina' )))
November
11, 2014 FINAL_DOCUMENT_2.19
54 | P a g e
Query 29 :Find the gender, address and the UID of the person who has
uploaded the documents for the updation process and has a unique biometric
id of '236A23EF-20A4-D9C7-A3C2-F0C88587239C'
select ac2.gender, ac2.address, ac2.uid
from aadhar_card2 ac2, aadhar_card1 ac1, citizen1 c1, update up
where ac2.uid = ac1.uid AND
ac1.biometric_data = '236A23EF-20A4-D9C7-A3C2-F0C88587239C'
AND
ac1.uid = c1.uid AND
c1.uid = up.uid AND
up.uploaded_documents = 'HAS'
November
11, 2014 FINAL_DOCUMENT_2.19
55 | P a g e
Query 30 : Table down the names of all SONS in a family who have uploaded
the documents for the updation process. ( the sons have UIDs)
select c2.citizen_name
from citizen2 c2, citizen1 c1
where c2.id = c1.id AND
c1.uid in ( select up.uid
from update up, citizen1 c1
where up.uid = c1.uid AND
up.uploaded_documents = 'HAS' AND
up.ration_card_id in ( select mof.ration_card_id
from member_of_family mof, update up
where mof.ration_card_id =
up.ration_card_id AND
mof. ration_card_id in (
select fam.ration_card_id
from
family fam, member_of_family mof
where
fam.ration_card_id=mof.ration_card_id AND
fam.relation='Son' )))
November
11, 2014 FINAL_DOCUMENT_2.19
56 | P a g e
JDBC Connectivity explored for lab case study :
We created a new table named CREDENTIALS. This table had ID,
USERNAME and a PASSWORD as it's attributes. This table was created
specifically for the purpose of creating a GUI which was authentic and
required a login into the aadhar card database.
November
11, 2014 FINAL_DOCUMENT_2.19
57 | P a g e
WHAT WE DID :
We were guided to create a MAIN Class ( Run class ), a
DBConnection class.
DBConnection.java
November
11, 2014 FINAL_DOCUMENT_2.19
59 | P a g e
After creating these two classes, we executed the queries we
wrote on the console in NETBEANS. Insert : For inserting into the database, this is the format to INSERT.
November
11, 2014 FINAL_DOCUMENT_2.19
60 | P a g e
GUI DESIGN :
Functionalities included :
1. Authentication : Firstly, the person would login. If the login is authentic,
he/she can go in the database further to UPDATE or DELETE the tuples.
November
11, 2014 FINAL_DOCUMENT_2.19
61 | P a g e
Here is how it happens..
Step 1 : Login. Say a person named Rooney with a password 189 tries to
login .
November
11, 2014 FINAL_DOCUMENT_2.19
62 | P a g e
As can be seen, ROONEY has the password 189, So he would successfully
LOG IN to the database. We return the citizen_name and the address of
ROONEY when he logins. Citizen_name is his actual name, provided the
USERNAME is his dummy name or a nick .
ON the net beans CONSOLE : ( after step-1 )
2. Step 2 : Now suppose, the person Rooney(actual name 'bucky') wishes
to update the database say his name and address, then
Before UPDATE :
November
11, 2014 FINAL_DOCUMENT_2.19
63 | P a g e
DURING UPDATE
Suppose the person bucky enters his new name as Rachit and
some address...
AFTER UPDATE
ON THE CONSOLE
IN THE DATABASE :
Earlier corresponding to 89 id, we had BUCKY, now updated with Rachit and a new address.
November
11, 2014 FINAL_DOCUMENT_2.19
64 | P a g e
Step 3: For delete (from the table citizen2)
Now if Rachit wants to delete his data,
He presses delete and
Before in database : ID 89 corresponds to Rachit before deleting,