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

Vincent

The document outlines the principles of database normalization, detailing the stages from First Normal Form (1NF) to Third Normal Form (3NF) and their importance in organizing data to minimize redundancy and improve integrity. It also discusses concurrency control mechanisms, such as Two-Phase Locking and deadlock prevention techniques, to maintain data consistency in multi-user environments. Additionally, it highlights advancements in database management, including automated normalization tools and AI-driven query optimization.
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)
24 views9 pages

Vincent

The document outlines the principles of database normalization, detailing the stages from First Normal Form (1NF) to Third Normal Form (3NF) and their importance in organizing data to minimize redundancy and improve integrity. It also discusses concurrency control mechanisms, such as Two-Phase Locking and deadlock prevention techniques, to maintain data consistency in multi-user environments. Additionally, it highlights advancements in database management, including automated normalization tools and AI-driven query optimization.
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

MONGU TRADES TRAINING INSTITUTE MANAGEMENT BOARD

BUSINESS STUDIES DEPARTMENT

OF IT SECTION

ADVANCED CERTIFICATE IN COMPUTER STUDIES

TERM ONE ASSIGNMENT ONE

PROGRAM : DIPLOMA IN COMPUTER STUDIES

COURSE : DATABASE PROGRAMMING

NAME : WAMULUME VINCENT MUBITA

NRC NO. : 383462/82/1

EXAM NO. : 831116

LECTURER : MR MBUMWAE
Normalization is a systematic approach to organizing data in a database to minimize and improve data
integrity.
First Normal Form (1NF)
First Normal Form (1NF) is the most basic level of database normalization. A table is said to be in 1NF if it
satisfies the following conditions:

1. Atomic Values: Each column (attribute) in the table must contain only atomic (indivisible) values. This
means that each cell should hold a single value, not a list, set, or any other composite structure.
2. Unique Column Names: Each column in the table must have a unique name to avoid ambiguity.
3. Orderless Rows: The order of rows in the table does not matter. Each row must be uniquely identifiable,
typically through a primary key.
4. No Repeating Groups: There should be no repeating groups of columns

Order_I D Customer_Nam Book_Title Author_Nam Publishe Pric Quantit Date


e e r e y
001 John Doe The Future Alice Baker ABC Pub 50 2 2024-05-
13
002 Jane Smith Data Science Bob Marks XYZ Pub 30 1 2024-05-
14
003 John Doe Machine Alice Baker ABC Pub 70 1 2024-05-
Learning 13

Second Normal Form (2NF)


Second Normal Form (2NF) builds on the principles of First Normal Form (1NF) and addresses issues
related to partial dependencies. A table is in 2NF if it satisfies the following conditions:

1. It Must Be in 1NF: The table must already satisfy the rules of 1NF (atomic values, unique column
names, no repeating groups, etc.).
2. No Partial Dependencies: Every non-prime attribute (an attribute not part of the primary key) must be
fully functionally dependent on the entire primary key, not just a part of it. This means that if the primary
key is composite (made up of multiple columns), no non-prime attribute should depend on only one part
of the key.

1. Orders Table
Order_I D Customer_Name Book_Title Quantity Date

001 John Doe The Future 2 2024-05-13


002 Jane Smith Data Science 1 2024-05-14
003 John Doe Machine Learning 1 2024-05-13

2. Books Table

Book_Title Author_Name Publisher Price

The Future Alice Baker ABC Pub 50

Data Science Bob Marks XYZ Pub 30

Machine Learning Alice Baker ABC Pub 70

Third Normal Form (3NF)


Third Normal Form (3NF) builds on the principles of Second Normal Form (2NF) and addresses issues
related to transitive dependencies. A table is in 3NF if it satisfies the following conditions:

1. It Must Be in 2NF: The table must already satisfy the rules of 2NF (no partial dependencies).

2. No Transitive Dependencies: Every non-prime attribute (an attribute not part of the primary key) must
be directly dependent on the primary key, and not indirectly dependent through another non-prime
attribute. In other words, there should be no situation where a non-prime attribute depends on another
non-prime attribute

1. Customers Table

Customer_ID First_Name Last_Name Other_Name

1 John Doe
2 Jane Smith

2. Authors Table
Author_ID First_Name Last_Name Other_Name

1 Alice Bakers

2 Bob Marks

3. Publishers Table

Publisher_ID Publisher_Name

1 ABC Pub

2 XYZ Pub

4. Books Table

Book_I Book_Title Author_ID Publisher_ID Price


D
1 The Future 1 1 50

2 Data Science 2 2 30

3 Machine Learning 1 1 70

5. Orders Table
Order_ID Customer_I D Book_ID Quantity Order_Dat
e
001 1 1 2 2024-05-13
002 2 2 1 2024-05-14
003 1 3 1 2024-05-13

b.) Entity-Relationship Diagram (ERD)


SQL queries:

a. select o.order_id,b.book_title,a.author_id,(b.price * o.quantity) as total_price from orders o join


books b on o.book_id = b.book_id join authors a on b.author_id =

a.author_id where o.customer_id = (select customer_id from customers where first_name = 'john');

b. create view total_amount_spent as select c.first_name,sum(b.price * o.quantity) as total_amount


from customers c join orders o on c.customer_id = o.customer_id join books b on o.book_id =
b.book_id group by c.first_name;

select * from total_amount_spent;

c. update books set price = price * 1.10 where publisher_id = (select publisher_id from publishers
where publisher_name = 'XYZ Pub');

select * from books where publisher_id = (select publisher_id from publishers where
publisher_name = 'XYZ Pub');
Importance of Normalization in Database Design

Normalization is a systematic approach to organizing data in a database to minimize redundancy and


improve data integrity. It involves breaking down large tables into smaller, related tables and defining
relationships between them. This process ensures efficient data management, retrieval, and scalability.

1. Functional Dependencies:

Functional dependencies describe the relationship between attributes in a database. For example, if
attribute A determines attribute B, knowing A allows us to uniquely identify B. This principle guides the
decomposition of tables, ensuring data is stored in one place, reducing redundancy. For instance, in a
bookstore database, a book's ISBN can serve as a primary key, linking all related data (title, author,
price) together.

2. Trade-offs in Database Decomposition:

While normalization improves data integrity and reduces redundancy, it can increase query complexity
and impact performance. Retrieving data from multiple tables often requires complex joins, which can
slow down response times, especially in large databases. Database designers must balance normalization
with performance considerations, ensuring the database remains efficient for its intended use.

3. Boyce-Codd Normal Form (BCNF):

BCNF is a stricter version of the Third Normal Form (3NF) and addresses certain types of redundancy
that can still exist in 3NF. It requires that every determinant in a relation is a candidate key. This
eliminates update, insertion, and deletion anomalies. For example, if a book's price changes, storing the
price in only one place prevents inconsistencies across the database.

Concurrency Control in Databases

Concurrency control ensures data consistency and integrity when multiple transactions occur
simultaneously. As databases are often accessed by multiple users at the same time, implementing
mechanisms to prevent conflicts and maintain data accuracy is crucial.

1. Two-Phase Locking (2PL):

2PL ensures serializability in transactions by requiring all locks to be acquired before any changes are
made to the database. It operates in two phases:

- Growing Phase: Locks are acquired.

- Shrinking Phase: Locks are released.

This structure prevents issues like lost updates and dirty reads, ensuring consistent transaction
execution.

2. Deadlock Prevention Techniques:

Deadlocks occur when two or more transactions wait indefinitely for resources held by each other.
Techniques like wait-die and wound-wait mitigate this risk:

- Wait-Die: Older transactions wait for younger ones to release locks, while younger transactions are
aborted if they request locks held by older transactions.
- Wound-Wait: Older transactions preempt younger ones, forcing them to release locks.

These approaches maintain transaction flow and prevent system unresponsiveness.

3. Snapshot Isolation:

Snapshot isolation allows transactions to read a consistent snapshot of the database at a specific point
in time. This enables multiple transactions to operate simultaneously without interfering with each other,
reducing the need for locks and improving performance while maintaining data integrity.

Conclusion

Normalization and concurrency control are fundamental to effective database design and management.
Normalization ensures data integrity and reduces redundancy, while concurrency control mechanisms
like 2PL, deadlock prevention, and snapshot isolation maintain consistency and performance in multi-
user environments. By carefully implementing these principles, database designers can create robust,
efficient, and reliable systems, leading to better data management and user satisfaction.

1. Automated Normalization Tools:

Modern database management systems (DBMS) now include automated tools that recommend and
apply normalization techniques, reducing the manual effort required by database designers.

2. Advanced Concurrency Control:

Techniques like multi-version concurrency control (MVCC) and optimistic concurrency control
(OCC) are increasingly used to enhance performance in high-traffic databases.

3. AI-Driven Query Optimization:

AI and machine learning are being integrated into DBMS to optimize query performance, especially in
highly normalized databases with complex joins.

4. Distributed Databases:

With the rise of distributed databases, normalization and concurrency control techniques are being
adapted to handle data spread across multiple nodes, ensuring consistency and performance in
decentralized environments (Cockroach Labs, 2023).

5. Blockchain Integration:

Blockchain technology is being explored for concurrency control in distributed databases, providing
immutable transaction logs and enhancing data integrity (Nakamoto, 2008).

By staying updated with these advancements, database professionals can continue to design systems that
are both efficient and reliable, meeting the demands of modern data-driven applications.

References

Bernstein, P. A., Hadzilacos, V., & Goodman, N. (1987). Concurrency Control and Recovery
in Database Systems. Addison-Wesley.
- Berenson, H., Bernstein, P. A., Gray, J., Melton, J., O'Neil, E. J., & O'Neil, P. E. (1995). A Critique of
ANSI SQL Isolation Levels. ACM SIGMOD Record, 24(2), 1-10.

- Codd, E. F. (1970). A Relational Model of Data for Large Shared Data Banks. Communications of the
ACM, 13(6), 377-387.

- Date, C. J. (2003). An Introduction to Database Systems(8th ed.). Addison-Wesley.

- Elmasri, R., & Navathe, S. B. (2016). Fundamentals of Database Systems(7th ed.). Pearson.

- Silberschatz, A., Korth, H. F., & Sudarshan, S. (2011). Database System Concepts(6th ed.). McGraw-
Hill.

You might also like