Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Database Technologies - ITA5008 TH

Digital Assignment - I

Submitted by: Submitted on:


Arun S 20/01/2022
22MCA0077
1. Explain all first Normal Form, second Normal Form, Third Normal Form and
BoyceCodd Normal Form (BCNF) with suitable examples?

Normal forms are standards that are used to design and organise relational
database tables in a specific way to minimise redundancy and dependency. There
are several normal forms, including the first normal form (1NF), second normal form
(2NF), third normal form (3NF), and Boyce-Codd normal form (BCNF). Here is an
explanation of each normal form, along with a example:
1. First normal form (1NF):
A table is in 1NF if it meets the following criteria:
● The table has a primary key, which is a unique identifier for each
row in the table.
● Each column in the table contains a single value.
● There are no repeating groups of columns.
For example, consider the following table:

Customer ID Customer Name Address Phone Number

1 John Smith 123 Main St 555-123-4567

2 Jane Doe 456 Park Ave 555-987-6543

3 Bob Johnson 789 Maple St 555-456-7890

This table is in 1NF because it has a primary key (the "Customer ID" column), each
column contains a single value, and there are no repeating groups of columns.

2. Second normal form (2NF):


A table is in 2NF if it meets the following criteria:
● The table is in 1NF.
● All non-key columns are fully dependent on the primary key.
For example, consider the following table:

Order ID Customer ID Product ID Quantity

1 1 101 2

2 1 102 1

3 2 101 3
4 3 102 2

5 3 103 1

This table is in 2NF because it is in 1NF (it has a primary key and each column
contains a single value) and all non-key columns are fully dependent on the primary
key (the "Customer ID" column).

3. Third normal form (3NF):


A table is in 3NF if it meets the following criteria:
● The table is in 2NF.
● There are no transitive dependencies (indirect dependencies) in
the table.
For example, consider the following table:

Employee ID Employee Name Department ID Department Name

1 John Smith 1 Marketing

2 Jane Doe 2 Sales

3 Bob Johnson 1 Marketing

This table is not in 3NF because there is a transitive dependency between the
"Department ID" and "Department Name" columns. Specifically, the "Department
Name" column is dependent on the "Department ID" column, which is in turn
dependent on the primary key ("Employee ID"). To put the table in 3NF, you would
need to split it into two separate tables: one for employees and one for departments.

4. Boyce-Codd normal form (BCNF) is a normal form in database design that is used
to eliminate redundancy and ensure that all dependencies in a table are full
functional dependencies (FDs).
A table is in BCNF if it meets the following criteria:
● The table is in 3NF.
● Every determinant (column that determines the value of another column) is a
candidate key (a column or set of columns that could be used as the primary
key of the table).
For example, consider the following table:

Employee ID Employee Name Department ID Department Name

1 John Smith 1 Marketing


2 Jane Doe 2 Sales

3 Bob Johnson 1 Marketing

This table is not in BCNF because the "Department ID" column is a determinant for
the "Department Name" column, but it is not a candidate key (it cannot be used as
the primary key of the table). To put the table in BCNF, you would need to split it into
two separate tables: one for employees and one for departments.
For example, the following two tables would be in BCNF:
Employees table:

Employee ID Employee Name Department ID

1 John Smith 1

2 Jane Doe 2

3 Bob Johnson 1

Departments table:

Department ID Department Name

1 Marketing

2 Sales

In these tables, the "Employee ID" and "Department ID" columns are candidate keys
and there are no transitive dependencies between columns.

2. Explain about B+ tree in DBMS with example?

A B+ tree is a type of balanced tree data structure that is used in database


management systems (DBMS) to store and retrieve data efficiently. B+ trees have
the following characteristics:
● They are self-balancing, meaning that the tree maintains a consistent shape
as elements are added or removed.
● They have a high degree of node fanout, meaning that each node in the tree
has a large number of children (usually between 100 and 1000).
● They store data at the leaf nodes of the tree, and use non-leaf nodes to store
pointers to the leaf nodes.
● They have a leaf node that contains a pointer to the next leaf node, creating a
linked list of all the leaf nodes. This allows for fast sequential access to the
data.
Here is an example of a B+ tree

10
/ \
6 14
/\ /\
3 8 11 19
/\ /\ /\ / \
1 4 7 9 12 17 22

In this example, the root node contains the values 10, 6, and 14. The non-leaf nodes
contain pointers to the leaf nodes, which contain the actual data values (1, 4, 7, etc.).
The leaf nodes are linked together in a linked list, allowing for fast sequential access
to the data.
B+ trees are often used in DBMSs because they allow for fast insertion, deletion, and
searching of data, and they are efficient at using disk space. They are particularly
useful for large data sets that do not fit in main memory.

3. Explain parallel algorithms for sorting in parallel DBMS?

Parallel algorithms are algorithms that are designed to run on multiple processors or
computers simultaneously, in order to solve a problem faster than a single processor
or computer could. In a parallel database management system (DBMS), parallel
algorithms can be used to sort large data sets in parallel, taking advantage of the
multiple processors or computers available.
There are several types of parallel algorithms that can be used for sorting in a
parallel DBMS, including:
1. Bitonic sort: This is a comparison-based sorting algorithm that uses a
divide-and-conquer approach to sort a list of values. It can be implemented in
parallel by dividing the list into smaller sublists and sorting them in parallel.
2. Merge sort: This is a comparison-based sorting algorithm that uses a
divide-and-conquer approach to sort a list of values. It can be implemented in
parallel by dividing the list into smaller sublists, sorting them in parallel, and
then merging the sorted sublists together in parallel.
3. Quicksort: This is a comparison-based sorting algorithm that uses a
divide-and-conquer approach to sort a list of values. It can be implemented in
parallel by dividing the list into smaller sublists and sorting them in parallel.
4. Radix sort: This is a non-comparison-based sorting algorithm that sorts values
by their digits (from least significant to most significant). It can be
implemented in parallel by dividing the list into smaller sublists and sorting
them in parallel.
These are just a few examples of parallel algorithms that can be used for sorting in a
parallel DBMS. There are many other algorithms available as well, each with its own
strengths and weaknesses. The choice of which algorithm to use will depend on the
specific requirements of the application and the resources available in the DBMS.

You might also like