Siyanganyambe
Siyanganyambe
LECTURER: MR MBUMWAE
1. Orders Table
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
2. Authors Table
3. Publishers Table
Publisher_ID Publisher_Name
1 ABC Pub
2 XYZ Pub
4. Books Table
c. update books set price = price * 1.10 where publisher_id = (select publisher_id
from publishers where publisher_name = 'XYZ Pub');
While normalization enhances data integrity and reduces redundancy, it also introduces
tradeoffs. One significant trade-off is the increased complexity in database queries. When
data is spread across multiple tables, retrieving information often requires complex joins,
which can impact performance. For instance, a query that retrieves customer orders along
with book details may involve joining several tables, which can slow down response times,
especially in large databases. Therefore, database designers must balance the benefits of
normalization with the potential performance impacts, ensuring that the database remains
efficient for its intended use.
Achieving Boyce-Codd Normal Form (BCNF) is critical for further reducing anomalies in
databases. BCNF is a stronger version of the Third Normal Form (3NF) and addresses certain
types of redundancy that can still exist in 3NF. Specifically, BCNF requires that every
determinant in a relation is a candidate key. This means that if one attribute determines
another, the determining attribute must be a primary key. By enforcing this rule, BCNF
eliminates update, insertion, and deletion anomalies that can occur when data is not properly
organized. For example, if a book's price changes, ensuring that the price is stored in only one
place prevents inconsistencies across the database.
One widely used method for concurrency control is the Two-Phase Locking (2PL) protocol.
This protocol ensures serializability in transactions by requiring that all locks be acquired
before any changes are made to the database. The 2PL protocol operates in two phases: the
growing phase, where locks are acquired, and the shrinking phase, where locks are released.
This structure helps prevent issues such as lost updates and dirty reads, ensuring that
transactions are executed in a consistent manner.
Snapshot Isolation
Another important concept in concurrency control is snapshot isolation, which provides high
concurrency with minimal locking overhead. This technique allows transactions to read a
consistent snapshot of the database at a specific point in time, enabling multiple transactions
to operate simultaneously without interfering with each other. Snapshot isolation enhances
performance by reducing the need for locks, thus allowing for faster transaction processing
while maintaining data integrity.
Conclusion