0% found this document useful (0 votes)
36 views9 pages

Q.1 What Is Normalisation? ANSWER:-Normalisation Is The Process of Structuring A Relational Database in Accordance

Normalisation is the process of structuring a relational database to minimize redundancy and improve data integrity. It involves separating data into tables and defining relationships between these tables through primary and foreign keys. This reduces data anomalies like inconsistent changes, inability to insert certain records, and unnecessary deletion of related records. The database is considered to be in third normal form when it satisfies the rules of first, second and third normal forms which helps achieve these benefits for most applications.

Uploaded by

madhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views9 pages

Q.1 What Is Normalisation? ANSWER:-Normalisation Is The Process of Structuring A Relational Database in Accordance

Normalisation is the process of structuring a relational database to minimize redundancy and improve data integrity. It involves separating data into tables and defining relationships between these tables through primary and foreign keys. This reduces data anomalies like inconsistent changes, inability to insert certain records, and unnecessary deletion of related records. The database is considered to be in third normal form when it satisfies the rules of first, second and third normal forms which helps achieve these benefits for most applications.

Uploaded by

madhav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Q.1 WHAT IS NORMALISATION?

ANSWER :- Normalisation is the process of structuring a relational database in accordance


with a series of so-called normal forms to reduce data redundancy and improve data integrity. It
was first proposed by Edgar F. Codd as part of his relational model. This includes creating tables
and establishing relationships between those tables according to rules designed both to protect
the data and to make the database more flexible by eliminating redundancy and inconsistent
dependency. Redundant data wastes disk space and creates maintenance problems. If data that
exists in more than one place must be changed, the data must be changed in the same way in all
locations. A customer address change is much easier to implement if that data is stored only in
the Customers table and nowhere else in the database. There are a few rules for database
normalization. Each rule is called a "normal form." If the first rule is observed, the database is
said to be in "first normal form." If the first three rules are observed, the database is considered
to be in "third normal form." Although other levels of normalization are possible, third normal
form is considered the highest-level necessary for most applications.
PROCESS:
 Identifying relationships among the attributes;
 Converting those relationships in the form of tables
 Combining these relations to form a database.

OBJECTIVES

 To free the collection of relations from undesirable insertion, update and deletion
dependencies.
 To reduce the need for restructuring the collection of relations, as new types of data are
introduced, and thus increase the life span of application programs.
 To make the relational model more informative to users.
 To make the collection of relations neutral to the query statistics, where these statistics
are liable to change as time goes by.

WHAT IF DATA IS NOT NORMALISED?

 Update anomaly. The same information can be expressed on multiple rows; therefore,


updates to the relation may result in logical inconsistencies. For example, each record in
an "Employees' Skills" relation might contain an Employee ID, Employee Address, and
Skill; thus, a change of address for a particular employee may need to be applied to
multiple records (one for each skill). If the update is only partially successful – the
employee's address is updated on some records but not others – then the relation is left in
an inconsistent state. Specifically, the relation provides conflicting answers to the
question of what this employee’s address is. This phenomenon is known as an update
anomaly.
 Insertion anomaly. There are circumstances in which certain facts cannot be recorded at
all. For example, each record in a "Faculty and Their Courses" relation might contain a
Faculty ID, Faculty Name, Faculty Hire Date, and Course Code. Therefore, we can
record the details of any faculty member who teaches at least one course, but we cannot
record a newly hired faculty member who has not yet been assigned to teach any courses,
except by setting the Course Code to null. This phenomenon is known as an insertion
anomaly.

 Deletion anomaly. Under certain circumstances, deletion of data representing certain


facts necessitates deletion of data representing completely different facts. The "Faculty
and Their Courses" relation described in the previous example suffers from this type of
anomaly, for if a faculty member temporarily ceases to be assigned to any courses, we
must delete the last of the records on which that faculty member appears, effectively also
deleting the faculty member, unless we set the Course Code to null. This phenomenon is
known as a deletion anomaly.

Q.2 WHAT IS FIRST NORMAL FORM? USE AN EXAMPLE TO EXPLAIN.

ANSWER:- First normal form (1NF) is a property of a relation in a relational database. A


relation is in first normal form if and only if the domain of each attribute contains only atomic
(indivisible) values, and the value of each attribute contains only a single value from that
domain. The first definition of the term, in a 1971 conference paper by Edgar Codd, defined a
relation to be in first normal form when none of its domains have any sets as elements.

First normal form is an essential property of a relation in a relational database. Database


normalization is the process of representing a database in terms of relations in standard normal
forms, where first normal is a minimal requirement.

A database is in first normal form if it satisfies the following conditions:

1. Contains only atomic values.


2. There are no repeating groups.

EXAMPLE

Below is a table that stores the names and telephone numbers of customers. One requirement
though is to retain multiple telephone numbers for some customers. The simplest way of
satisfying this requirement is to allow the "Telephone Number" column in any given row to
contain more than one value:
Customer

Customer ID First Name Surname Telephone Number

123 Pooja Singh 9373636474, 8976737363

456 San Zhang 7672677272, 9292929345

789 John Doe 9834784748

The telephone number column contains multiple phone numbers in a single value. For example,
the first row has two telephone numbers separated by a comma. The column values are not
atomic: it can be subdivided into two numbers. This violates first normal form.

Here condition 1 is violated.

An apparent solution is to introduce more columns:

Customer

Customer Telephone
First Name Surname Telephone Number2
ID Number1

123 Pooja Singh 9373636474 8976737363

456 San Zhang 7672677272 9292929345

789 John Doe 9834784748

Technically, this table does not violate the requirement for values to be atomic. However,
informally, the two telephone number columns still form a "repeating group": they repeat what
is conceptually the same attribute, namely a telephone number. An arbitrary and hence
meaningless ordering has been introduced.

Here condition 2 is violated.


SOLUTIONS

ALTERNATIVE 1:

To bring the model into the first normal form, we split the strings we used to hold our telephone
number information into "atomic" (i.e. indivisible) entities: single phone numbers. And we
ensure no row contains more than one phone number.

Customer

Customer Surnam
First Name Telephone Number
ID e

123 Pooja Singh 9373636474

123 Pooja Singh 8976737363

456 San Zhang 7672677272

456 San Zhang 9292929345

789 John Doe 9834784748


ALTERNATIVE 2:

Customer Name Customer Telephone Number

Customer Id Customer ID Telephone Number


First Name Surname
ID

1 123 9373636474
123 Pooja Singh

2 123 8976737363
456 San Zhang

3 456 7672677272
789 John Doe

4 456 9292929345

5 789 9834784748

Columns do not contain more than one telephone number in this design. Instead, each Customer-
to-Telephone Number link appears on its own row. Using Customer ID as key, a one-to-
many relationship exists between the name and the number tables. A row in the "parent"
table, Customer Name, can be associated with many telephone number rows in the "child"
table, Customer Telephone Number, but each telephone number belongs to one, and only one
customer.

Q.3 WHAT IS CANDIDATE KEY, PRIMARY KEY, ALTERNATE KEY, FOREIGN


KEY?

ANSWER :- A key is an attribute or set of an attribute which helps you to identify a row in a
relation(table). They allow you to find the relation between two tables. Keys help you uniquely
identify a row in a table by a combination of one or more columns in that table.

Here, are reasons for using Keys in the DBMS system.


 Keys help you to identify any row of data in a table. In a real-world application, a table could
contain thousands of records. Moreover, the records could be duplicated. Keys ensure that you
can uniquely identify a table record despite these challenges.
 Allows you to establish a relationship between and identify the relation between tables
 Help you to enforce identity and integrity in the relationship.

PRIMARY KEY is a column or group of columns in a table that uniquely identify every row in
that table. The Primary Key can't be a duplicate meaning the same value can't appear more than
once in the table. A table cannot have more than one primary key.

Rules for defining Primary key:


 Two rows can't have the same primary key value
 It must for every row to have a primary key value.
 The primary key field cannot be null.
 The value in a primary key column can never be modified or updated if any foreign key
refers to that primary key.

Employee ID First Name Last Name

11 Andrew Johnson

22 Tom Wood

33 Alex Hale

In the above-given example, employee ID is a primary key because it uniquely identifies an


employee record. In this table, no other employee can have the same employee ID.

ALTERNATE KEY is a column or group of columns in a table that uniquely identify every row
in that table. A table can have multiple choices for a primary key but only one can be set as the
primary key. All the keys which are not primary key are called an Alternate Key.

Example:
In this table, StudID, Roll No, Email are qualified to become a primary key. But since StudID is
the primary key, Roll No, Email becomes the alternative key.
StudID Roll No First Name LastName Email

1 11 Tom Price [email protected]

2 12 Nick Wright [email protected]

3 13 Dana Natan [email protected]

CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table. Candidate Key is
a super key with no repeated attributes. The Primary key should be selected from the candidate
keys. Every table must have at least a single candidate key. A table can have multiple candidate
keys but only a single primary key.

Properties of Candidate key:


 It must contain unique values
 Candidate key may have multiple attributes
 Must not contain null values
 It should contain minimum fields to ensure uniqueness
 Uniquely identify each record in a table

Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to
uniquely identify the student record in the table.

StudID Roll No First Name LastName Email

1 11 Tom Price [email protected]

2 12 Nick Wright [email protected]

3 13 Dana Natan [email protected]


A FOREIGN KEY is a key used to link two tables together. It is a field (or collection of fields)
in one table that refers to the PRIMARY KEY in another table. The table containing the foreign
key is called the child table, and the table containing the candidate key is called the referenced or
parent table. The purpose of Foreign keys is to maintain data integrity and allow navigation
between two different instances of an entity. It acts as a cross-reference between two tables as it
references the primary key of another table.

Look at the following two tables:

"Persons" table:

PersonID LastName FirstName

1 Hansen Ola

2 Svendson Tove

3 Pettersen Kari

"Orders" table:

OrderID OrderNumber PersonID

1 77895 3

2 44678 3

3 22456 2

4 24562 1

Notice that the "PersonID" column in the "Orders" table points to the "PersonID" column in the
"Persons" table.

The "PersonID" column in the "Persons" table is the PRIMARY KEY in the "Persons" table.
The "PersonID" column in the "Orders" table is a FOREIGN KEY in the "Orders" table.

The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables.
It also prevents invalid data from being inserted into the foreign key column, because it must be
one of the values contained in the table it points to.

You might also like