Docsity

DBMS-Unit I- Introduction To Database System - Google Docs, Study notes of Database Management Systems (DBMS)

Toggle sidebar
bg1
—---------- Notes for DBMS —-----------
Unit I: Introduction to Database System
1.1 Database Concepts
1. Data
∙ Raw facts and unprocessed information.
∙ Alone, it has no meaning.
∙ Example: "John", "90", "Math" — these become meaningful when structured as: John
scored 90 in Math.
2. Database
∙ A structured collection of data stored electronically and accessed through software. ∙
Ensures data consistency , integrity , and ease of access .
∙ Example: Student database stores roll number, name, marks, and attendance.
3. Database Management System (DBMS)
∙ A software suite that interacts with the database, users, and other programs. ∙
Allows:
o Storage
o Modification
o Querying
o Access control
∙ Popular DBMSs: MySQL, Oracle, PostgreSQL, MS SQL Server.
4. File System vs. DBMS
Feature
Data
Redundancy
Data
Consistency
Security
Querying
File System
DBMS
Low (controlled via keys)
Maintained through
constraints Role-based,
access-controlled SQL
enables easy retrieval
Automated tools available
High (duplicate data)
Hard to ensure
Basic file permissions
Manual search in files
Manual
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download DBMS-Unit I- Introduction To Database System - Google Docs and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

—---------- Notes for DBMS —-----------

Unit I: Introduction to Database System

1.1 Database Concepts

1. Data

∙ Raw facts and unprocessed information. ∙ Alone, it has no meaning. ∙ Example: "John", "90", "Math" — these become meaningful when structured as: John scored 90 in Math.

2. Database

∙ A structured collection of data stored electronically and accessed through software. ∙ Ensures data consistency , integrity , and ease of access. ∙ Example: Student database stores roll number, name, marks, and attendance.

3. Database Management System (DBMS)

∙ A software suite that interacts with the database, users, and other programs. ∙ Allows: o Storage o Modification o Querying o Access control ∙ Popular DBMSs: MySQL, Oracle, PostgreSQL, MS SQL Server.

4. File System vs. DBMS

Feature Data Redundancy Data Consistency Security Querying File System DBMS Low (controlled via keys) Maintained through constraints Role-based, access-controlled SQL enables easy retrieval Automated tools available High (duplicate data) Hard to ensure Basic file permissions Manual search in files Manual

Backup/Recovery 1 | P a g e Explanation: A traditional file system stores data in files without relationships, leading to duplication and inconsistency. DBMS solves this by managing data efficiently using schemas and constraints.

5. Applications of DBMS

∙ Banking: Transactions, account details. ∙ Airlines: Booking and passenger data. ∙ Universities: Courses, grades, attendance. ∙ E-commerce: Products, customers, inventory. ∙ Hospitals: Patients, staff, medical records. Explanation: Any system that requires structured, searchable, and secure data uses DBMS.

6. Data Abstraction

∙ DBMS provides abstraction to hide complexity from users. Three Levels:

  1. Physical Level: How data is stored (files, blocks, indexes).
  2. Logical Level: What data is stored (tables, columns).
  3. View Level: Custom views for users (students see only their marks). Explanation: This layering ensures users can work with data without needing to know technical storage details.

7. Data Independence

∙ Ability to change schema at one level without affecting the next. Types:

  1. Physical Data Independence: Change storage without altering table structure. o E.g., moving from HDD to SSD.
  2. Logical Data Independence: Change table structure without affecting user views.

∙ Rule 1 (Information Rule): All data is stored in tables. ∙ Rule 3 (Null Handling): Systematic representation of missing values. ∙ Rule 6 (View Updating): Views must be updatable. ∙ Rule 9 (Logical Data Independence): User views remain unaffected by logical changes. 3 | P a g e Explanation: These rules define the functionality and completeness of a relational DBMS.

10. Overall Structure of a DBMS

Key Components:

  1. Query Processor: Interprets and compiles user queries (e.g., SQL).
  2. Storage Manager: Manages disk space, files, indexing.
  3. Transaction Manager: Ensures atomicity, consistency, isolation, durability (ACID).
  4. Metadata Catalog: Stores schema and user data definitions.
  5. Authorization Manager: Controls user access and permissions.
  6. Users: End-users, application programmers, and DBAs.

1.2 Architecture: - Two tier and Three tier architecture of database

A database stores important information that needs to be accessed quickly and securely. Choosing the right DBMS architecture is essential for organizing, managing, and maintaining the data efficiently. It defines how users interact with the database to read, write, or update information. The schema acts as a blueprint, detailing tables, fields, and relationships. A well-designed architecture and schema ensure data consistency, improve performance, and keep data secure. Types of DBMS Architecture There are several types of DBMS Architecture that we use according to the usage requirements. ∙ 1-Tier Architecture ∙ 2-Tier Architecture ∙ 3-Tier Architecture

⮚ 1-Tier Architecture

In 1-Tier Architecture, the user works directly with the database on the same system. This means the client, server, and database are all located on one machine. The user can open the application, interact with the data, and perform tasks without needing a separate server or network connection.

∙ A common example is Microsoft Excel. Everything from the user interface to the logic and data storage happens on the same device. The user enters data, performs calculations, and saves files directly on their computer. ∙ This setup is simple and easy to use, making it ideal for personal or standalone applications. It does not require a network or complex setup, which is why it's often used in small-scale or individual use cases. ∙ This architecture is simple and works well for personal, standalone applications where no external server or network connection is needed. 4 | P a g e DBMS 1-Tier Architecture Advantages of 1-Tier Architecture Below mentioned are the advantages of 1-Tier Architecture. ∙ Simple Architecture: 1-Tier Architecture is the simplest architecture to set up, as only a single machine is required to maintain it. ∙ Cost-Effective: No additional hardware is required for implementing 1-Tier Architecture, which makes it cost-effective. ∙ Easy to Implement: 1-Tier Architecture can be easily deployed, and hence it is mostly used in small projects. Disadvantages of 1-Tier Architecture ∙ Limited to Single User: Only one person can use the application at a time. It’s not designed for multiple users or teamwork. ∙ Poor Security: Since everything is on the same machine, if someone gets access to the system, they can access both the data and the application easily. ∙ No Centralized Control: Data is stored locally, so there's no central database. This makes it hard to manage or back up data across multiple devices. ∙ Hard to Share Data: Sharing data between users is difficult because everything is stored on one computer.

∙ Low Cost: 2-Tier Architecture is cheaper than 3-Tier Architecture and Multi-Tier Architecture. ∙ Easy Deployment: 2-Tier Architecture is easier to deploy than 3-Tier Architecture. ∙ Simple: 2-Tier Architecture is easily understandable as well as simple because of only two components. Disadvantages of 2-Tier Architecture ∙ Limited Scalability: As the number of users increases, the system performance can slow down because the server gets overloaded with too many requests. ∙ Security Issues: Clients connect directly to the database, which can make the system more vulnerable to attacks or data leaks. 6 | P a g e ∙ Tight Coupling: The client and the server are closely linked. If the database changes, the client application often needs to be updated too. ∙ Difficult Maintenance: Managing updates, fixing bugs, or adding features becomes harder when the number of users or systems increases.

⮚ 3-Tier Architecture

In 3-Tier Architecture, there is another layer between the client and the server. The client does not directly communicate with the server. Instead, it interacts with an application server which further communicates with the database system and then the query processing and transaction management takes place. This intermediate layer acts as a medium for the exchange of partially processed data between the server and the client. This type of architecture is used in the case of large web applications. Example: E-commerce Store ∙ User : You visit an online store, search for a product and add it to your cart. ∙ Processing : The system checks if the product is in stock, calculates the total price and applies any discounts. ∙ Database : The product details, your cart and order history are stored in the database for future reference.

DBMS 3-Tier Architecture 7 | P a g e Advantages of 3-Tier Architecture ∙ Enhanced scalability: Scalability is enhanced due to the distributed deployment of application servers. Now, individual connections need not be made between the client and server. ∙ Data Integrity: 3-Tier Architecture maintains Data Integrity. Since there is a middle layer between the client and the server, data corruption can be avoided/removed. ∙ Security: 3-Tier Architecture Improves Security. This type of model prevents direct interaction of the client with the server thereby reducing access to unauthorized data. Disadvantages of 3-Tier Architecture ∙ More Complex: 3-Tier Architecture is more complex in comparison to 2-Tier Architecture. Communication Points are also doubled in 3-Tier Architecture. ∙ Difficult to Interact: It becomes difficult for this sort of interaction to take place due to the presence of middle layers. ∙ Slower Response Time: Since the request passes through an extra layer (application server), it may take more time to get a response compared to 2-Tier systems. ∙ Higher Cost: Setting up and maintaining three separate layers (client, server, and database) requires more hardware, software, and skilled people. This makes it more expensive.

Advantages of the Hierarchical Data Model ∙ Because of its tree form, it is easy to grasp. ∙ Retrieving data in a one-to-many connection is efficient. Disadvantages of the Hierarchical Data Model ∙ Inflexibility in reorganizing data. ∙ accessing complicated data structures may be challenging. ∙ redundant data storage, which might cause anomalies and inconsistencies. 9 | P a g e ⮚ What is a Network Data Model? It is the advance version of the hierarchical data model. To organize data it uses directed graphs instead of the tree-structure. In this child can have more than one parent. It uses the concept of the two data structures i.e. Records and Sets.

In the above figure, Project is the root node which has two children i.e. Project 1 and Project

  1. Project 1 has 3 children and Project 2 has 2 children. Total there are 5 children i.e Department A, Department B and Department C, they are network related children as we said that this model can have more than one parent. So, for the Department B and Department C have two parents i.e. Project 1 and Project 2. Advantages of the Network Data Model ∙ Because of its numerous parent ties, it is more adaptable than the hierarchical approach. ∙ Ideal for managing intricate, many-to-many connections. Disadvantages of the Network Data Model ∙ Increased complexity in database design and management. ∙ requires complex programming in order to manage and work with data. 10 | P a g e ⮚ What is a Relational Data Model? The relational data model was developed by E.F. Codd in 1970. There are no physical links as they are in the hierarchical data model. Following are the properties of the relational data model: ∙ Data is represented in the form of table only. ∙ It deals only with the data not with the physical structure. ∙ It provides information regarding metadata. ∙ At the intersection of row and column there will be only one value for the tuple. ∙ It provides a way to handle the queries with ease.

To organize records, it uses tree structure. It organizes records in the form of directed graphs. It organizes records in the form of tables. It implements 1:1 and 1:n relations. In addition to 1:1 and 1:n it also implements many to many relationships. In addition to 1:1 and 1:n it also implements many to many relationships. Pointers are used to establish relationships among records physically. A linked list is used to establish a relationship among records physically. The logical representation is used with rows and columns to depict relationship among records. Insertion anomaly exits in this model i.e. child node cannot be inserted without the parent node. There is no insertion anomaly. There is no insertion anomaly. Deletion anomaly exists in this model i.e. it is difficult to delete the parent node. There is no deletion anomaly. There is no deletion anomaly. Update leads to inconsistency problems because of the existence of multiple instances of a child record. No such problem as only one instance of records exist. Updating a record is easy and simple with the process of normalization, the redundant data gets removed. 12 | P a g e Hierarchical Data Model Network Data Model Relational Data Model This model lacks data independence. There is partial data independence in this model. This model provides data independence. No such facility for querying database is supported. No such facility for querying database is supported. SQL-based declarative querying is supported.

It is used to access the data which is complex and asymmetric. It is used to access the data which is complex and symmetric. It is used to access the data which is complex and symmetric. Difficult to design a database because of its complexity. Difficult to design a database and manipulate a database because of its complexity. Hence, it imposes a burden on the programmer. It is easy to comprehend due to concealed physical level details from end users. It is less flexible. It is flexible as compared to the hierarchical model. It is flexible as compared to the hierarchical model. &XML and XAML use this model. VAX-DBMS, DMS-1100 of UNIVAC and SUPRADBMS's use this model. It is mostly used in real world applications. Oracle, SQL. 13 | P a g e