DBMS 1
DBMS 1
.
7 .Draw an ER diagram that captures the following information. A
company database needs to store information about employees,
departments and children of employees. Employees work in the
department each department is managed by an employee, a child must be
identified uniquely by name when the parent (who is an employee
assume that only one parent works for the company) is known. We are
not interested in information about the child once the parent leaves the
company.
8.SHORT NOTES ON:
Hashing.
Indexing
Structure
Ans :
Hashing
Hashing is a technique used to map data items to unique identifiers called hash
values. This mapping is typically done using a hash function, which takes an
input value and produces a fixed-size output. Hashing is commonly used for:
Data storage: Hashing is used to efficiently store and retrieve data in
hash tables, which are data structures that allow for fast lookup of
elements based on their hash values.
Data integrity: Hashing is used to verify the integrity of data by
comparing the hash of a file or message with a previously computed
hash. If the hashes differ, it indicates that the data has been modified.
Cryptography: Hashing is used in cryptographic algorithms to create
digital signatures and protect passwords.
Indexing
Indexing is a technique used to improve the efficiency of data retrieval in
databases. It involves creating a data structure that stores information about
the location of specific values within a table. This data structure, called an
index, can be used to quickly locate rows that match a particular search
condition.
There are different types of indexes, including:
Primary index: A unique index that is automatically created on the
primary key of a table.
Secondary index: A non-unique index that can be created on any column
or combination of columns in a table.
Clustered index: An index that stores data rows in the physical order of
the index keys.
Non-clustered index: An index that stores pointers to data rows, rather
than the data itself.
Indexing can significantly improve query performance, especially for large
datasets or complex queries. However, creating and maintaining indexes can
also add overhead to database operations.
Structure
The structure of a database refers to the organization and arrangement of data
within the database. It is typically defined using a data model, such as the
relational data model or the object-oriented data model.
The structure of a database includes:
Entities: Objects or concepts that represent the data being stored.
Attributes: Properties or characteristics of entities.
Relationships: Associations between entities.
Constraints: Rules that govern the data stored in the database.
The structure of a database has a significant impact on its performance,
efficiency, and maintainability. A well-designed database structure can make it
easier to manage and query data, while a poorly designed structure can lead to
performance problems and data inconsistencies
10. Explain database architecture in detail
Ans : Database architecture refers to the overall design and structure of a
database system. It defines how data is stored, processed, and accessed, as
well as how various components of the database system interact with each
other. A well-defined database architecture ensures efficient data
management, seamless interaction between different layers, and optimal
performance.
Types of Database Architecture
1. 1-Tier Architecture (Single Tier)
o Concept: In a 1-tier architecture, the database resides directly on
the client system, and the user directly interacts with the
database. All the database management operations (application,
presentation, and database layers) occur on the same system.
o Use Case: Primarily used in small applications, desktop-based
systems, or for development purposes.
o Example: A personal application like Microsoft Access where the
user interacts directly with the database.
Advantages:
o Simple to implement and manage.
o No need for a separate server or network infrastructure.
Disadvantages:
o Not suitable for large, distributed systems.
o Limited scalability and security.
2. 2-Tier Architecture (Client-Server Architecture)
o Concept: In a 2-tier architecture, the system is divided into two
parts: Client and Server. The client is responsible for interacting
with the user and sending requests to the server. The server
handles the database, processes the client’s request, and sends
the required data back to the client.
Client Tier: The user interface resides at the client side.
Server Tier: The database is stored at the server side, and
the server processes the client’s queries.
o Use Case: Commonly used in applications that require a direct
connection between a client and the database, like small or
medium-sized web applications.
o Example: A banking system where the application installed on the
client’s machine interacts with the central database located on the
server.
Advantages:
o Better security than 1-tier architecture.
o Separation of client and server improves performance by
distributing the workload.
Disadvantages:
o Scalability can be an issue with growing user demands.
o A direct connection between the client and the database increases
security risks.
3. 3-Tier Architecture (Three-Layer Architecture)
o Concept: The 3-tier architecture adds an additional middle layer
between the client and the server. The layers are:
Presentation Layer (Client): This is the user interface, where
users interact with the system (e.g., a web browser or
mobile app).
Application Layer (Middle Tier): Also known as the business
logic layer, it processes user requests, applies business
rules, and communicates with the database.
Database Layer (Data Tier): The actual database resides
here, and it is managed by a database server. The
application layer sends queries to the database and receives
the requested data.
o Use Case: Widely used in web applications and large enterprise
systems where security, scalability, and maintainability are
essential.
o Example: An e-commerce website where the user interacts with
the frontend (presentation layer), the business logic is handled by
the middle layer (processing user actions), and the database stores
information such as product details and customer orders.
Advantages:
o Improved security: The client does not interact directly with the
database, making the system more secure.
o Scalability: The architecture can handle a larger number of users
and complex operations.
o Easy maintenance: The separation of layers makes it easier to
manage, update, and maintain.
Disadvantages:
o More complex to set up and manage than 1-tier and 2-tier
architectures.
o Slightly slower than 2-tier due to the additional layer of
communication.