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

DBMS LYQ – 2017

1. Answer any eight questions:

(a) To design a dictionary which data Structure is used?

> A hash table or associative array data structure is commonly used to design a dictionary.

(b) What is dual in Oracle?

> In Oracle, "dual" is a one-row, one-column table often used for various purposes in SQL queries and PL/SQL code.

(c) Differenciate between function and procedure.

> Functions return a single value and are used for computations, while procedures do not return values directly and
are used for performing actions or tasks.

(d) What is the significance of key in the context of DBMS?

> In the context of a DBMS (Database Management System), the key is significant as it uniquely identifies each record
or row in a database table, enabling efficient data retrieval, indexing, and maintaining data integrity.

(e) What is the usefulness of Meta data?

> Metadata is useful for data understanding, management, and governance, aiding in data discovery, quality, and
documentation.

(f) "Processed data is called information" — Justify your answer.

> "Processed data is called information" because data becomes meaningful and actionable when it is processed,
organized, and presented in context.

(g) What is multivalued dependency?

> Multivalued dependency is a concept in database normalization where a non-prime attribute depends on a subset
of the primary key but not on the entire primary key.

(h) What do you mean by integrity of a database?

> Integrity of a database refers to data accuracy, consistency, and reliability, including entity, referential, domain, and
user-defined integrity.

(i) What is DSN?

> DSN (Data Source Name) is a configuration specifying how to connect to a database, including driver, server
address, and authentication details.

(j) Define Closure?

> Closure, in the context of databases and formal languages, is the set of all attributes or functional dependencies
that can be logically derived from a given set of attributes or dependencies.

2. (a) Discuss advantages of DBMS over file system. 8+8=16

> Advantages of DBMS over File System:

1. Data Integrity and Accuracy: DBMS enforces data integrity constraints, ensuring data accuracy and consistency. In
contrast, file systems lack built-in mechanisms to maintain data integrity.

2. Data Security: DBMS provides user authentication and authorization, allowing fine-grained control over who can
access and modify data. File systems often have limited or no security features.
3. Data Sharing: DBMS allows concurrent access to data by multiple users, ensuring data consistency and preventing
data corruption. File systems may lead to data inconsistencies in a multi-user environment.

4. Data Redundancy Reduction: DBMS minimizes data redundancy through normalization, reducing storage space
and improving data consistency. File systems often result in duplicated data.

5. Data Retrieval: DBMS offers powerful query languages (e.g., SQL) for efficient data retrieval and manipulation.
File systems require custom programming for data extraction.

6. Data Scalability: DBMS can handle large datasets and scale to accommodate growing data needs. File systems
may encounter scalability issues as data volumes increase.

7. Backup and Recovery: DBMS provides automated backup and recovery mechanisms, ensuring data availability in
case of failures. File systems require manual backup and recovery procedures.

8. Data Maintenance: DBMS simplifies data maintenance tasks like data updates, deletes, and schema changes. File
systems may require manual, error-prone data maintenance.

(b) Discuss the role of a good Database Administrator (DBA).

> Role of a Database Administrator (DBA):

A good Database Administrator (DBA) plays a crucial role in managing and maintaining a database system. Their
responsibilities include:

1. Database Design: DBAs design and plan the database structure, including defining tables, relationships, and data
constraints to ensure efficient data storage and retrieval.

2. Installation and Configuration: They install and configure the database management system, ensuring it meets
the organization's requirements and performance needs.

3. Security Management: DBAs implement security measures to protect sensitive data. They manage user access,
permissions, and encryption to prevent unauthorized access and data breaches.

4. Performance Tuning: DBAs monitor database performance, optimize queries, and fine-tune system parameters to
ensure efficient data processing and response times.

5. Backup and Recovery: They establish and maintain backup and recovery procedures to safeguard data against
disasters, hardware failures, or accidental deletions.

6. Data Migration: DBAs manage data migration tasks when transitioning to a new database system or upgrading
the existing one, ensuring data integrity during the process.

7. Data Integrity: They enforce data integrity constraints, validate data quality, and resolve data inconsistencies to
maintain accurate and reliable data.

8. Monitoring and Troubleshooting: DBAs continuously monitor the database for issues, diagnose problems, and
apply fixes or optimizations to maintain system stability.

9. Disaster Recovery Planning: They develop and test disaster recovery plans to minimize data loss and downtime in
the event of a system failure or disaster.

10. Compliance and Regulation: DBAs ensure that the database complies with industry-specific regulations and data
protection laws, such as GDPR or HIPAA.
11. Documentation: They maintain comprehensive documentation of the database schema, configurations, and
procedures to facilitate knowledge sharing and future reference.

In summary, a skilled DBA is essential for the effective management, security, performance, and integrity of a
database system, ensuring that it meets the organization's data needs and compliance requirements.

3. (a) Suppose a person named TOM has a savings bank account in 'XYZ' bank and has a debit card(ATM). TOM
wants to use his debit card to a ATM for cash withdrawal. In the above context explain the ACID property behind
the transaction. 8+8=16

> The ACID properties are a set of properties that ensure the reliability and consistency of transactions in a database
system. Let's apply these properties to TOM's ATM cash withdrawal scenario:

1. Atomicity: The atomicity property ensures that a transaction is treated as a single, indivisible unit. In the context
of TOM's ATM withdrawal:

• If TOM initiates a cash withdrawal from his savings account using the debit card, the entire transaction must
be completed or none at all. There should be no partial withdrawal.
• If TOM's account balance is updated to reflect the withdrawal, it must be done entirely. If any part of the
transaction fails (e.g., due to a system error or insufficient funds), the system should ensure that the account
balance remains unchanged.

2. Consistency: The consistency property ensures that a transaction takes the database from one consistent state to
another. In TOM's ATM withdrawal:

• Before the transaction, TOM's account balance should be sufficient to cover the withdrawal amount.
• After the transaction, the account balance should reflect the deducted withdrawal amount. The balance
should not be negative or inconsistent.

3. Isolation: The isolation property ensures that concurrent transactions do not interfere with each other. In the
ATM scenario:

• If TOM is conducting the withdrawal, the system should ensure that no other transaction (e.g., deposit or
balance inquiry) on his account interferes with the withdrawal.
• Concurrent transactions by other customers should not impact the consistency of TOM's withdrawal.

4. Durability: The durability property ensures that once a transaction is committed, its effects are permanent and
survive system failures. In TOM's ATM withdrawal:

• Once the ATM transaction is completed, the system should guarantee that the updated account balance is
permanently stored and will not be lost, even in the event of a power outage or system crash.
• TOM should be able to rely on the fact that the cash withdrawal and balance update are durable and not lost
due to system failures.

(b) Define Anomaly in the context of normalization.

> Anomaly in the context of normalization refers to data points that are significantly different from the majority of
the data within a dataset after applying a normalization process. Normalization is a data preprocessing technique
used to transform and scale data so that it conforms to a common scale or distribution, making it easier to analyze or
model. Anomalies, in this context, are values that stand out as unusual or exceptional compared to the normalized
data, and they often represent unexpected or rare occurrences. Here's a more detailed explanation of anomalies in
the context of normalization, elaborating on key points:
1. Normalization Purpose: Normalization is employed to standardize data, ensuring that different attributes or
features of the dataset have comparable scales. This can be particularly important in various data analysis
and machine learning tasks to prevent certain features from dominating the analysis due to their larger
scales.
2. Transformation Process: During normalization, data is typically transformed in such a way that it has a
common scale or distribution. Common normalization techniques include Min-Max scaling, Z-score
normalization, and logarithmic transformations, among others. These transformations aim to make the data
more amenable to statistical analysis or modeling.
3. Anomalies Defined: Anomalies are data points that, even after normalization, exhibit characteristics that
significantly deviate from the majority of the normalized data. They are values that appear to be outliers or
exceptions within the normalized dataset.
4. Significance: Anomalies can be significant because they often represent unusual or unexpected events,
errors, or extreme values. Detecting anomalies is crucial in various applications, such as fraud detection,
quality control, and monitoring systems, where identifying rare and potentially problematic occurrences is
essential.
5. Detection Methods: Detecting anomalies in normalized data may involve statistical methods (e.g., Z-score or
modified z-score methods), machine learning approaches (e.g., isolation forests, one-class SVMs, or
autoencoders), or domain-specific knowledge-based techniques. These methods aim to distinguish normal
data patterns from anomalies.
6. Handling Anomalies: Once anomalies are detected, they can be handled in various ways depending on the
context. In some cases, anomalies may be treated as errors and removed from the dataset. In other cases,
anomalies may be valuable insights or signals of interest, and they are retained for further analysis or
specific actions.
7. Impact on Analysis: Anomalies can significantly impact the results of data analysis or machine learning
models if not appropriately addressed. They can skew statistical measures, distort model predictions, and
lead to incorrect conclusions.
8. Iterative Process: Detecting and handling anomalies is often an iterative process that may involve multiple
rounds of normalization and anomaly detection as part of the data preprocessing workflow.

In summary, anomalies in the context of normalization refer to data points that stand out as exceptional or unusual
compared to the majority of the data even after applying normalization techniques. Detecting and appropriately
handling these anomalies is essential for accurate and reliable data analysis and modeling.

4. (b) Describe the network model to design DBMS. 4

> Designing a Database Management System (DBMS) involves creating a network model that defines the structure
and organization of the database. In a network model for a DBMS, data is represented as interconnected records,
and the relationships between records are a fundamental aspect of the design. Here's a brief description of the
network model for DBMS in 4 marks:

1. Record Structures: In the network model, data is organized into record structures. These records are similar
to entities or tables in a relational database. Each record contains fields or attributes to represent different
types of data.
2. Relationships: One of the key features of the network model is the representation of relationships between
records. Records are connected through pointers or links, establishing parent-child relationships. Unlike the
hierarchical model, which only allows for a one-to-many relationship, the network model supports many-to-
many relationships.
3. Navigational Access: Accessing data in the network model is navigational, meaning you start at a known
record and navigate through the relationships using pointers to access related records. This allows for
complex and flexible data retrieval but requires a good understanding of the database structure.
4. Advantages and Disadvantages: The network model is useful for representing complex, interconnected data
with intricate relationships. It provides flexibility in modeling data but can be more challenging to design and
maintain compared to simpler models like the hierarchical or relational models. Additionally, it's less
commonly used today, with the relational model being the predominant choice for modern database
management systems.
In summary, the network model for DBMS organizes data into interconnected records with relationships established
through pointers or links. It supports complex data structures but is relatively less common and more complex to
design and maintain compared to other database models like the relational model.

5. (a) Suppose you have two options to analyse data from different tables. 3+3+5+5=16

(i) Selection, Projection, Union.

(ii) Union, Sclection, Projection.

Which one will you prefer and why?

> (a) When analyzing data from different tables, the order of operations (Selection, Projection, Union) versus (Union,
Selection, Projection) can impact the result and efficiency of your query.

The choice between these two approaches depends on your specific requirements:

• Option (i) is generally preferred when you want to minimize the amount of data you're working with as early
as possible in the query. Applying selection first can reduce the dataset size before more complex operations
like projection and union.
• Option (ii) might be more suitable when you need to combine data from different tables before filtering or if
you need to apply the same filter criteria to all the tables simultaneously.

Ultimately, the choice should be based on the nature of your data and the specific analysis goals.

(b) Discuss data dictionary.

> Data Dictionary:

• A data dictionary is a centralized repository or database that stores metadata and information about the
structure, organization, and attributes of data within a database system.
• It contains descriptions and definitions of tables, columns, relationships, data types, constraints, and other
elements used in the database.
• Data dictionaries are important for data management, as they provide a comprehensive reference for
database administrators, developers, and users. They help ensure data consistency, integrity, and accuracy
by providing a clear understanding of the data's meaning and structure.

(c) Explain dependency preservation.

> Dependency Preservation:

• Dependency preservation refers to a property in database design where transformations or modifications to


the database schema, such as normalization, do not result in the loss of functional dependencies that held in
the original schema.
• Functional dependencies are relationships between attributes in a relational database that dictate how
changes in one attribute affect other attributes.
• When designing or modifying a database, it's essential to ensure that functional dependencies, which may
include primary keys, candidate keys, and other constraints, are preserved to maintain data integrity and
consistency.

(d) Explain Strong and weak entity set with example.

> Strong and Weak Entity Set:


• Strong Entity Set: A strong entity set is an entity set that has a primary key attribute and can exist
independently, meaning it does not rely on the existence of another entity to be uniquely identified. For
example, in a database of students, the "Student" entity is a strong entity because it can be uniquely
identified by its student ID, and it exists on its own.
• Weak Entity Set: A weak entity set is an entity set that does not have a primary key attribute on its own and
relies on another entity, called the "owning" or "parent" entity, for identification. It has a partial key, which
is a set of attributes within the weak entity set that, in combination with the owning entity's primary key,
can uniquely identify its entities. For example, in a database, a "Room" entity might be considered weak if it
relies on a combination of the building's ID and the room number to uniquely identify rooms within a
building.

In summary, strong entity sets have their own primary keys and can exist independently, while weak entity sets rely
on another entity for identification and have partial keys to establish uniqueness when combined with the owning
entity's primary key.

6. Consider the relation schema:

Teacher (T_no, T_name, Salary, dept_no)

Dept (dept_no, dept_name)

(a) Show all teachers name and salary whose T_no is 108.

(b) Show the details of all teachers working in the Computer Science department.

(c) Show total salary of each department.

(d) Show total salary of all teachers.

(e) Show the names of teachers in ascending order of department wise.

(f) Show minimum salary of each department.

(g) Show the name of the teacher for which minimum salary is paid.

(h) Show the details of employee who draw minimum salary among all employee.

> To perform these SQL queries, we'll assume you have two tables: "Teacher" and "Dept" with the specified
attributes. Here are the SQL queries for each of the given tasks:

(a) Show all teachers' names and salaries whose T_no is 108.

```sql

SELECT T_name, Salary

FROM Teacher

WHERE T_no = 108;

```

(b) Show the details of all teachers working in the Computer Science department.

```sql

SELECT *

FROM Teacher

WHERE dept_no = (SELECT dept_no FROM Dept WHERE dept_name = 'Computer Science');

```
(c) Show the total salary of each department.

```sql

SELECT Dept.dept_name, SUM(Teacher.Salary) AS total_salary

FROM Teacher

INNER JOIN Dept ON Teacher.dept_no = Dept.dept_no

GROUP BY Dept.dept_name;

(d) Show the total salary of all teachers.

```sql

SELECT SUM(Salary) AS total_salary

FROM Teacher;

```

(e) Show the names of teachers in ascending order of department-wise.

```sql

SELECT Teacher.T_name, Dept.dept_name

FROM Teacher

INNER JOIN Dept ON Teacher.dept_no = Dept.dept_no

ORDER BY Dept.dept_name, Teacher.T_name;

```

(f) Show the minimum salary of each department.

```sql

SELECT Dept.dept_name, MIN(Teacher.Salary) AS min_salary

FROM Teacher

INNER JOIN Dept ON Teacher.dept_no = Dept.dept_no

GROUP BY Dept.dept_name;

```

(g) Show the name of the teacher for whom the minimum salary is paid in each department.

```sql

SELECT T2.T_name, D1.dept_name

FROM Teacher T2

INNER JOIN (

SELECT dept_no, MIN(Salary) AS min_salary

FROM Teacher

GROUP BY dept_no

) T1 ON T2.dept_no = T1.dept_no AND T2.Salary = T1.min_salary


INNER JOIN Dept D1 ON T2.dept_no = D1.dept_no;

```

(h) Show the details of the employee who draws the minimum salary among all employees.

```sql

SELECT *

FROM Teacher

WHERE Salary = (SELECT MIN(Salary) FROM Teacher);

```

7. Write short notes on any two:

(a) Cardinality of Relationship

> Cardinality of Relationship (8 marks):

In the context of a relational database, the cardinality of a relationship refers to the number of associations between
two entity sets in a database schema. It defines how many instances of one entity can be related to how many
instances of another entity. Cardinality is crucial for designing the relationships between tables in a database and
understanding how data is related. Here's a brief explanation:

1. One-to-One (1:1): In a one-to-one relationship, each entity in one set is associated with exactly one entity in
the other set, and vice versa. For example, in a database schema, you might have a "Person" entity related
to a "Passport" entity, where each person has one passport, and each passport belongs to one person.
2. One-to-Many (1:N): In a one-to-many relationship, each entity in one set can be associated with multiple
entities in the other set, but each entity in the second set can be associated with only one entity in the first
set. For instance, in a database for a library, each "Author" can have written multiple "Books," but each
"Book" is authored by one author.
3. Many-to-One (N:1): This is the reverse of one-to-many, where multiple entities in the first set can be
associated with a single entity in the second set. For example, in an "Order" database, many customer orders
can be associated with a single customer.
4. Many-to-Many (N:N): In a many-to-many relationship, multiple entities in one set can be associated with
multiple entities in the other set. This often requires an intermediary table, known as a junction table or
associative table, to manage the relationship. For instance, in a database for a music store, many
"Customers" can purchase many different "CDs."

Understanding cardinality is essential for designing the database schema, defining foreign keys and constraints, and
ensuring data integrity.

(b) Lossless join decomposition

> Lossless Join Decomposition (8 marks):

Lossless join decomposition is a property in database design that ensures that no information is lost when a relation
(table) is decomposed into smaller relations (tables). The goal is to break down a large relation into smaller ones
while preserving the ability to reconstruct the original relation using joins. Here's a brief overview:

1. Decomposition: When designing a relational database, you may create multiple tables to organize data
efficiently and avoid data redundancy. Decomposition involves splitting a single relation into two or more
smaller relations.
2. Lossless Join: Lossless join decomposition ensures that when you join the smaller tables (resulting from
decomposition), you can reconstruct the original table without losing any data or producing spurious
records.
3. Dependency Preservation: Lossless join decomposition also ensures that functional dependencies
(relationships between attributes) are preserved across the decomposed tables, allowing you to maintain
data integrity and consistency.
4. Example: Consider a relation "Employee" with attributes (EmployeeID, FirstName, LastName, Department).
If you decompose it into "EmployeeInfo" (EmployeeID, FirstName, LastName) and "EmployeeDept"
(EmployeeID, Department), you should be able to join these tables and obtain the original "Employee"
relation.

Achieving lossless join decomposition is important to avoid data anomalies and inconsistencies during database
operations, particularly when joining tables to retrieve meaningful information.

(c) Database security

> Database Security (8 marks):

Database security is a critical aspect of information technology that focuses on protecting data stored within a
database management system (DBMS) from unauthorized access, misuse, disclosure, alteration, or destruction. It
encompasses various measures, controls, and practices to ensure the confidentiality, integrity, and availability of
data. Here are key points about database security:

1. Authentication: Authentication mechanisms, such as username/password combinations or multi-factor


authentication, verify the identity of users and grant them access based on their credentials.
2. Authorization: Authorization controls determine what actions users are allowed to perform within the
database. This includes defining roles, permissions, and access levels for different users or user groups.
3. Encryption: Encryption techniques are used to protect data at rest (stored data) and data in transit (data
being transmitted over a network). This ensures that even if an attacker gains access to the data, it remains
unintelligible without the proper decryption keys.
4. Auditing and Logging: Database systems often include auditing and logging features that record activities
and changes made to the database. These logs can help detect and investigate security incidents.
5. Data Masking: Data masking or redaction is used to hide sensitive information, such as personally
identifiable information (PII), when displaying data to users who don't need to see the full details.
6. Access Control: Access control mechanisms restrict access to certain parts of the database or specific rows
and columns within tables based on user roles and permissions.
7. Backup and Disaster Recovery: Regular database backups and disaster recovery plans ensure that data can
be restored in the event of data loss due to security breaches or other incidents.
8. Security Patching: Keeping the DBMS and associated software up to date with security patches is essential
to address vulnerabilities that could be exploited by attackers.

Database security is a multifaceted field that requires continuous monitoring and adaptation to evolving threats. It is
a fundamental aspect of data management, especially in organizations where sensitive or confidential data is stored.

You might also like