Old Q Answers (KTM)
Old Q Answers (KTM)
Old Q Answers (KTM)
Data refers to raw, unprocessed facts. For example, a list of names and phone numbers is data. Data
on its own has no meaning until it is processed and analyzed.
Eg: customer information in database
Data only does not have any meaning.
Data needs to be processed to turn into information.
Information refers to data that has been processed.
It is the result of analyzing and interpreting data.
1
What is the benefit of normalization?
Normalization is the process of organizing data in a database to reduce data redundancy and improve
data integrity, performance, prevent data inconsistency and reduce storage space required.
Benefits of normalization in DBMS:
Minimizes data redundancy: Normalization eliminates data redundancy by breaking down larger
tables into smaller ones and storing data only once. This not only reduces the amount of disk space
required to store data but also reduces the risk of data inconsistencies.
Improved data integrity: by removing data redundancy, normalization prevents data anomalies and
data inconsistency. This improves data accuracy and reliability.
Simplifies database design: Normalization simplifies the database design by breaking down complex
data structures into smaller, more manageable tables. This makes it easier to maintain and update the
database over time.
Improves database performance: Normalization can improve database performance by reducing the
amount of data that needs to be manipulated (insert, update and delete). This can result in faster
query response times.
It makes easier to extract the required information from the database. This helps to speed up the
performance of queries and reduces the time required to retrieve data.
2
Eg: bookstore
Book, Author
A book can have multiple author
An author can have multiple books
Worker, skill
Student, course
Book, author
Passenger, flight
1NF
The first step of normalization is called first normal form. The step includes in 1NF are:
Identify the entities and attributes.
Eliminate any repeating groups by creating separate tables.
Create a primary key for each table to ensure that each record can be uniquely identified. A primary
key can be a single field or a combination of fields.
Ensure that each attribute contains only atomic (indivisible) values.
By following these steps, we can transform a database into first normal form, which ensures that
each table contains no repeating groups and each record can be uniquely identified by a primary key.
This helps to eliminate redundancy and improve data integrity in the database.
2NF
To make the table into 2NF, the following steps are needed
Ensure that table is already in first normal form.
Each table must have primary key that uniquely identify each row in a table.
Each column must contain single value.
Identify partial dependency to separate the table into multiple tables.
A partial dependency occurs when part of the primary key determines the value of non-key attribute.
Eg: A, B is composite primary key of the table and C, D and E are non-key attributes of that table.
If A determine C, this means that the attribute C is partially dependent on the composite primary key
A, B. At this condition, we need to separate attribute A and C into another table because attribute C
is partially depend on the composite primary key.
Ensure that each non-key attribute is functionally dependent on the entire primary key.
Create relationships: Create relationships between the tables using primary and foreign keys.
3
3NF
Eliminate transitive dependencies
Eg: A is primary key of a table and B, C and D are non-key attributes of that table.
If non-key attribute B is functionally determine on attribute C, this is called transitive dependency.
We need to separate B and C into another table.
Set appropriate primary key and foreign key for these tables.
What are the advantages of DBMS?
A database management system (DBMS) is a software system that manages and organizes data in a
database. The advantages of DBMS include:
Data integration: DBMS allows for integration of data from multiple sources into a single database,
which provides a unified view of data. This makes it easier to manage data and reduces data
redundancy.
Data sharing: DBMS enables multiple users to access the same data simultaneously.
Data consistency: DBMS ensures that data is consistent and accurate by enforcing data integrity rules
and constraints. This prevents data inconsistencies and ensures that data is accurate and reliable.
Data security: DBMS provides data access control mechanism by preventing unauthorized access of
data. Authorized users can access the data in the database. DBMS can provide advanced security
features such as access control and authorization, ensuring that sensitive data is only accessible to
authorized users.
Backup and recovery: DBMS provides backup and recovery mechanisms to protect data from
hardware and software failures.
4
Why a company would decide to implement a DBMS?
A company would decide to implement a Database Management System (DBMS) for several
reasons, including:
Data storage and organization: A DBMS can help a company store and organize large amounts of
data in a structured way, making it easier to access, manage, and analyze.
Improved data security: A DBMS can provide better security for sensitive data, such as customer
information or financial records, by implementing access controls.
Data integrity: A DBMS can ensure the consistency and accuracy of data by enforcing rules and
constraints on the data, preventing errors and inconsistencies.
Improved data accessibility: A DBMS can provide simultaneous access to data by multiple users and
sharing of information.
Scalability: A DBMS can handle large amounts of data.
5
Overdraft fees and other charges: Because batch processing only updated account information once
per day, there was a risk that customers could overdraw their accounts without realizing it. For
example, if a customer made a withdrawal in the morning and then made another withdrawal later in
the day, they may not have seen the updated balance before making the second withdrawal. This
could result in overdraft fees or other charges, which could be costly for customers.
Explain how a typical sql statement is structured and what needs to be included. 3marks
A typical sql statement consist of one or more clauses that specify the operation to be performed.
Select: select clause is used to specify the columns that you want to retrieve from the database.
From: from clause specifies the name of the table from which you want to retrieve the data.
Eg: from table_name
Where: where clause is used to filter the data from one or more tables based on certain condition.
Order by: order by clause is used to sort the result data in alphabetical order ascending or descending
for each column.
Eg: order by name desc
6
Many-to-many relationship enforces the duplication of data. It can waste the storage space of the
database.
Data inconsistency can be occurred in many-to-many relationship when insert, update or delete the
data.
Many-to-many relationship can cause the data inconsistency. It is difficult to ensure that all instances
of the data are updated or deleted correctly because there are too much data duplication in the
database.
One of the common approach to solve the many-to-many relationship is to use junction table
between these two tables. It contains the primary keys of both tables as foreign keys.
This can help to reduce data duplication, data inconsistency and to improve performance of the
database.
7
Sales tracking and analysis: Databases can be used to track sales data, including the number of units
sold, revenue generated, and other metrics. This data can be used to analyze sales trends, identify
popular products, and inform pricing and marketing decisions.
Customer relationship management
(CRM): Supermarkets may use databases to store and manage customer data, such as purchase
history, contact information, and loyalty program details. This data can be used to personalize
marketing campaigns, improve customer service, and build customer loyalty.
Employee management: Supermarkets may use databases to manage employee information,
including scheduling, payroll, and performance metrics.
Overall, databases play a critical role in the daily operations of supermarkets, helping them to
manage inventory, track sales data, and provide a better customer experience.
CASE Tools
Case tools (Computer-Aided Software Engineering tools) are software applications that help
software developers and engineers to design, develop, and maintain software systems. These tools
automate the software development process and help in increasing the efficiency and productivity of
the development team.
8
Case tools can be classified into different categories based on their functionality, such as:
Requirements gathering tools: These tools help in collecting, documenting, and managing the
software requirements.
Analysis and design tools: These tools help in creating the software design by visualizing the
system's structure, components, and functionality.
Implementation tools: These tools help in generating the code, testing, debugging, and integrating the
software components.
Maintenance tools: These tools help in managing and updating the software after its release.
Some examples of popular case tools include Rational Rose, Visual Paradigm, Enterprise Architect,
and MagicDraw. These tools offer a wide range of functionalities and features, such as modeling,
simulation, code generation, and testing, to support the entire software development life cycle.
9
Locking prevents other users and applications from accessing data while it is being updated. In some
databases, locking applies to the entire table, which creates a negative impact on application
performance. Other databases, such as Oracle relational databases, apply locks at the record level,
leaving the other records within the table available, helping ensure better application performance.
Concurrency manages the activity when multiple users or applications invoke queries at the same
time on the same database. This capability provides the right access to users and applications
according to policies defined for data control.
10