Database Management Systems Exam Paper
Database Management Systems Exam Paper
Functional dependency describes a relationship that exists when one attribute uniquely determines another attribute within a database. The main types include trivial functional dependency, where a subset of an attribute set determines the set; non-trivial functional dependency, where a subset of attributes determines different attributes; and full functional dependency, which is significant in identifying candidate keys. These dependencies are crucial for database normalization, as they determine how tables should be decomposed to eliminate redundancy and ensure integrity .
Deadlock occurs in a database when two or more transactions are unable to proceed because each is waiting for the other to release resources. The necessary conditions for deadlock include mutual exclusion (only one transaction can use a resource at a time), hold and wait (transactions holding resources can request more), no preemption (resources cannot be forcibly taken from a transaction), and circular wait (a closed chain of transactions exist, each waiting for the next). Deadlocks can be handled through prevention (altering conditions), avoidance (ensuring system state remains safe), detection (identifying and resolving deadlocks), or recovery (preemptively rolling back transactions).
Views in a DBMS are virtual tables created by querying data from one or more tables. They are significant for database integrity by presenting a consistent, secure 'window' into the data that can restrict user access to specific data elements. Views help in maintaining security by allowing users access only to particular data without exposing actual table structures and sensitive information. They also simplify complex queries and can present an aggregated and filtered data view, enhancing user-friendliness .
Normalization is the process of organizing data to minimize redundancy and improve data integrity. Second Normal Form (2NF) is achieved when a database is in First Normal Form (1NF) and all non-key attributes are fully functional dependent on the primary key. Third Normal Form (3NF) builds upon 2NF by ensuring no transitive dependencies exist, meaning non-key attributes are not dependent on other non-key attributes. The primary benefit of 2NF is eliminating partial dependency, while 3NF removes transitive dependency, further reducing redundancy and potential anomalies .
Converting an ER diagram into tables involves several key steps: identifying entities and converting them into tables, determining primary keys, transforming relationships by adding foreign keys, dealing with multivalued attributes by creating separate tables, and ensuring all attributes are correctly mapped to the tables. This process involves analyzing the ER diagram to ensure that entity sets and relationship sets are accurately represented in a relational schema with proper constraints .
DDL (Data Definition Language) is used to define database structures, such as creating tables. For example, the 'CREATE TABLE' command is DDL. DML (Data Manipulation Language) is utilized for data manipulation; 'SELECT', 'INSERT', 'UPDATE', and 'DELETE' are examples of DML commands for querying and modifying data. DCL (Data Control Language) is involved in the control of access to data; 'GRANT' and 'REVOKE' are DCL commands used to provide or remove authorizations. Each language serves a specific role in database management, addressing different aspects of data handling and security .
The three-level architecture of a DBMS consists of the internal level, conceptual level, and external level. It provides a clear separation between how data is stored, the logical structure of the entire database, and user-specific views. The internal level is concerned with physical data storage, the conceptual level with logical data structure (e.g., relationships and constraints), and the external level with user-specific views. This architecture helps in data abstraction and independence, allowing changes at one level without affecting others. It enhances data security by restricting user access to only relevant data and promotes efficient data retrieval due to the separation of storage and logical schema .
A transaction in a database is a sequence of operations performed as a single logical unit of work, typically encapsulating tasks such as data retrieval or updates. The key properties of transactions, known as ACID properties, include Atomicity (ensuring all parts of a transaction are completed; if not, the transaction is void), Consistency (maintaining database integrity constraints), Isolation (concurrent transaction execution doesn't affect each other), and Durability (ensuring once a transaction is committed, it remains so despite failures). These properties ensure reliable processing of database transactions .
Locking mechanisms are used to control concurrent access to data resources in a database to ensure data consistency and integrity. Two-phase locking is a concurrency control method that divides the transaction processing into two phases—a growing phase, where locks are acquired without being released, and a shrinking phase, where locks are released and no new locks are acquired. Types of locks include shared locks (allowing read but not write access) and exclusive locks (allowing read and write access). Two-phase locking ensures consistency by preventing conflicting operations from occurring simultaneously .
A Database Administrator (DBA) is responsible for installing, configuring, and maintaining a database management system (DBMS). The DBA ensures data integrity, security, and availability, manages database access, performs backups and recovery, and ensures optimal performance of the database. They also configure hardware and software aspects of the DBMS environment, monitor system performance, and handle query tuning and index recommendations .