Wednesday 3 April 2024

DBMS NOTES UNIT 3

 

                                                            UNIT 3 

ER (Entity Relationship)


An entity-relationship model is known as an ER model. This data model is at a high level. The data items and relationships for a given system are defined using this model.
It creates the database's conceptual design. Additionally, it creates a highly straightforward and user-friendly data view.
An entity-relationship diagram is a type of diagram used in entity-relationship modelling to represent the database structure.

Assume, for instance, that we create a database for a school. The student will be an entity in this database with attributes such as name, address, ID, age, and so forth. There will be a relationship between the address and other entities that include attributes like the city, street name, pin code, etc.



components of ER diagram are:

Entity: Weak entity, Strong entity 

Attributes: Key, composite, multivaluded, single, derived, singular etc.

Relationship: One to one, one to many, many to one, many to many.



Entity: An entity can be any kind of thing, person, place, or class. Rectangles can be used in the ER diagram to represent an entity.

Using an organisation as an example, one can treat a manager, a product, an employee, a department, etc. as an entity.

Weak entity,
A weak entity is an entity that is dependent on another entity. The weak entity lacks any essential characteristic of its own. A double rectangle serves as the weak entity's representation.Ex installment is depended on loan for value.

Attribute :


An entity's property is described by its attribute. Eclipse is a tool for attribute representation.

A student's identity, age, contact information, name, and so forth are examples of qualities.

 a. Key Attribute


An entity's primary attributes are represented by its key attribute. It stands for a principal key. The text is emphasized and an ellipse is used to symbolise the main attribute.


b. Composite Attribute

A composite characteristic is one that is made up of numerous other attributes. An ellipse is used to symbolise the composite attribute, and those ellipses are joined by another ellipse.c. Multidimensional Property
c. Multivalued 
Multiple values are possible for an attribute. We refer to these characteristics as multivalued attributes. A multivalued attribute is represented by a double oval.

A student may, for instance, possess many phone numbers.

d. Derived Attribute 
Originated Characteristic

A derived attribute is one that may be obtained from another attribute. It can be shown as an ellipse with a dash.

An individual's age, for instance, varies with time and might be inferred from another characteristic, such as their birthdate.




  
Relationship
The relationship between entities is expressed through a relationship. A rhombus or diamond is used to symbolise the partnership.

One to One

A relationship is referred to as one to one when there is just one instance of each entity involved.

As an illustration, a woman can marry one man, and a man can marry one woman.


One-to-many 

A one-to-many relationship exists when there is only one instance of the entity on the left and multiple instances of the entity on the right that are associated with the relationship.

For instance, a scientist is capable of creating numerous inventions, but only that one particular creation.

Many to one 


A relationship is said to as many-to-one when there are multiple instances of the left entity and only one instance of the right entity associated with it.

For instance, a student may enrol in just one course, yet there may be several students in one course.


many-to-many 

A relationship is referred to as many-to-many when multiple instances of the entity on the left and multiple instances of the entity on the right are associated with it.

For instance, a person may be assigned to numerous projects, and a project may employ numerous people.



 

Abstraction:

Abstraction is the process of simplifying complex systems by focusing on essential details while hiding unnecessary complexities. In the context of ER diagrams:

Entity Abstraction: Entities represent real-world objects or concepts, abstracted from their detailed properties. For example, in a university database, entities like Student, Course, and Instructor represent real-world entities without considering all their attributes.

Relationship Abstraction: Relationships represent associations between entities, abstracted from the specific attributes involved. For instance, a relationship between Student and Course might represent enrollment, without specifying details like enrollment date or grade.

Attribute Abstraction: Attributes define the properties of entities and relationships, abstracted from their detailed implementation. For example, a Student entity might have attributes like StudentID, Name, and Age, abstracting away details like the format of StudentID or the calculation of Age.

Abstraction allows ER diagrams to focus on the essential aspects of the database structure, making it easier to understand and communicate complex relationships.

Integration:

Integration involves combining different components or perspectives into a unified whole. In ER diagrams, integration occurs in several ways:

Entity Integration: Entities from different parts of the system are integrated into a single diagram, showing their relationships and interactions. For example, a university database might integrate entities like Student, Course, and Department into a single ER diagram.

Relationship Integration: Relationships between entities are integrated to show how different parts of the system interact with each other. For instance, in the university database, relationships between Student and Course, Instructor and Course, etc., are integrated to illustrate the overall structure of the academic system.

Attribute Integration: Attributes from various entities and relationships are integrated to depict the complete set of data elements in the system. This integration helps understand the data requirements and dependencies across different components.

Integration ensures that ER diagrams provide a comprehensive view of the database structure, capturing all relevant entities, relationships, and attributes necessary for system understanding and design.

In summary, abstraction and integration are fundamental principles in ER diagram creation and interpretation. They enable the representation of complex database structures in a clear and concise manner, facilitating effective communication and system design.

What is the Relational Model? 
The relational model represents how data is stored in Relational Databases. A relational database consists of a collection of tables, each of which is assigned a unique name. Consider a relation STUDENT with attributes ROLL_NO, NAME, ADDRESS, PHONE, and AGE shown in the table. 

Table Student  ROLL_NO NAME ADDRESS PHONE AGE
1 RAM DELHI 9455123451 18
2 RAMESH GURGAON 9652431543 18
3 SUJIT ROHTAK 9156253131 20
4 SURESH DELHI 18
 

Important Terminologies
Attribute: Attributes are the properties that define an entity. e.g.; ROLL_NO, NAME, ADDRESS
Relation Schema: A relation schema defines the structure of the relation and represents the name of the relation with its attributes. e.g.; STUDENT (ROLL_NO, NAME, ADDRESS, PHONE, and AGE) is the relation schema for STUDENT. If a schema has more than 1 relation, it is called Relational Schema.
Tuple: Each row in the relation is known as a tuple. The above relation contains 4 tuples, one of which is shown as:
1 RAM DELHI 9455123451 18
Relation Instance: The set of tuples of a relation at a particular instance of time is called a relation instance. Table 1 shows the relation instance of STUDENT at a particular time. It can change whenever there is an insertion, deletion, or update in the database.
Degree: The number of attributes in the relation is known as the degree of the relation. The STUDENT relation defined above has degree 5.
Cardinality: The number of tuples in a relation is known as cardinality. The STUDENT relation defined above has cardinality 4.
Column: The column represents the set of values for a particular attribute. The column ROLL_NO is extracted from the relation STUDENT.
ROLL_NO
1

2

3

4

NULL Values: The value which is not known or unavailable is called a NULL value. It is represented by blank space. e.g.; PHONE of STUDENT having ROLL_NO 4 is NULL. 
Relation Key: These are basically the keys that are used to identify the rows uniquely or also help in identifying tables. These are of the following types.
Primary Key
Candidate Key
Super Key
Foreign Key
Alternate Key
Composite Key
Constraints in Relational Model
While designing the Relational Model, we define some conditions which must hold for data present in the database are called Constraints. These constraints are checked before performing any operation (insertion, deletion, and updation ) in the database. If there is a violation of any of the constraints, the operation will fail.

Domain Constraints
These are attribute-level constraints. An attribute can only take values that lie inside the domain range. e.g.; If a constraint AGE>0 is applied to STUDENT relation, inserting a negative value of AGE will result in failure.

Key Integrity
Every relation in the database should have at least one set of attributes that defines a tuple uniquely. Those set of attributes is called keys. e.g.; ROLL_NO in STUDENT is key. No two students can have the same roll number. So a key has two properties: 

It should be unique for all tuples.
It can’t have NULL values.
Referential Integrity
When one attribute of a relation can only take values from another attribute of the same relation or any other relation, it is called referential integrity. Let us suppose we have 2 relations 

Table Student 

ROLL_NO NAME ADDRESS PHONE AGE BRANCH_CODE
1 RAM DELHI 9455123451 18 CS
2 RAMESH GURGAON 9652431543 18 CS
3 SUJIT ROHTAK 9156253131 20 ECE
4 SURESH DELHI 18 IT
Table Branch 

BRANCH_CODE BRANCH_NAME
CS COMPUTER SCIENCE
IT INFORMATION TECHNOLOGY
ECE ELECTRONICS AND COMMUNICATION ENGINEERING
CV CIVIL ENGINEERING
BRANCH_CODE of STUDENT can only take the values which are present in BRANCH_CODE of BRANCH which is called referential integrity constraint. The relation which is referencing another relation is called REFERENCING RELATION (STUDENT in this case) and the relation to which other relations refer is called REFERENCED RELATION (BRANCH in this case). 

Anomalies in the Relational Model
An anomaly is an irregularity or something which deviates from the expected or normal state. When designing databases, we identify three types of anomalies: Insert, Update, and Delete.

Insertion Anomaly in Referencing Relation
We can’t insert a row in REFERENCING RELATION if referencing attribute’s value is not present in the referenced attribute value. e.g.; Insertion of a student with BRANCH_CODE ‘ME’ in STUDENT relation will result in an error because ‘ME’ is not present in BRANCH_CODE of BRANCH. 

Deletion/ Updation Anomaly in Referenced Relation: 
We can’t delete or update a row from REFERENCED RELATION if the value of REFERENCED ATTRIBUTE is used in the value of REFERENCING ATTRIBUTE. e.g; if we try to delete a tuple from BRANCH having BRANCH_CODE ‘CS’, it will result in an error because ‘CS’ is referenced by BRANCH_CODE of STUDENT, but if we try to delete the row from BRANCH with BRANCH_CODE CV, it will be deleted as the value is not been used by referencing relation. It can be handled by the following method: 

On Delete Cascade
It will delete the tuples from REFERENCING RELATION if the value used by REFERENCING ATTRIBUTE is deleted from REFERENCED RELATION. e.g.; For, if we delete a row from BRANCH with BRANCH_CODE ‘CS’, the rows in STUDENT relation with BRANCH_CODE CS (ROLL_NO 1 and 2 in this case) will be deleted. 

On Update Cascade
It will update the REFERENCING ATTRIBUTE in REFERENCING RELATION if the attribute value used by REFERENCING ATTRIBUTE is updated in REFERENCED RELATION. e.g;, if we update a row from BRANCH with BRANCH_CODE ‘CS’ to ‘CSE’, the rows in STUDENT relation with BRANCH_CODE CS (ROLL_NO 1 and 2 in this case) will be updated with BRANCH_CODE ‘CSE’.

Super Keys
Any set of attributes that allows us to identify unique rows (tuples) in a given relationship is known as super keys. Out of these super keys, we can always choose a proper subset among these that can be used as a primary key. Such keys are known as Candidate keys. If there is a combination of two or more attributes that are being used as the primary key then we call it a Composite key.

Codd Rules in Relational Model
Edgar F Codd proposed the relational database model where he stated rules. Now these are known as Codd’s Rules. For any database to be the perfect one, it has to follow the rules.

For more, refer to Codd Rules in Relational Model.

Advantages of the Relational Model
Simple model: Relational Model is simple and easy to use in comparison to other languages.
Flexible: Relational Model is more flexible than any other relational model present.
Secure: Relational Model is more secure than any other relational model.
Data Accuracy: Data is more accurate in the relational data model.
Data Integrity: The integrity of the data is maintained in the relational model.
Operations can be Applied Easily: It is better to perform operations in the relational model.
Disadvantages of the Relational Model
Relational Database Model is not very good for large databases.
Sometimes, it becomes difficult to find the relation between tables.
Because of the complex structure, the response time for queries is high.
Characteristics of the Relational Model
Data is represented in rows and columns called relations.
Data is stored in tables having relationships between them called the Relational model.
The relational model supports the operations like Data definition, Data manipulation, and Transaction management.
Each column has a distinct name and they are representing attributes.
Each row represents a single entity.


Properties of Relations
The relation's name is unique compared to all other relations.
There is exactly one atomic (single) value in every relation cell.
Every characteristic has a unique name.
The attribute domain is meaningless.
Tuple is free of duplicate values.
A tuple's order may differ in its sequence.

DBMS NOTES UNIT 2

                                           DBMS NOTES

UNIT 2


Database System Architecture 

Three-level architecture or ANSI/SPARC architecture are other names for the three-schema design.
A specific database system's structure is described using this approach.
The physical database and user apps are kept apart using the three schema architecture.

There are three levels in the three schema architecture. The database is divided into three sections by it. 





Three Schema Architecture's Goals
Three-level architecture's primary goal is to save the underlying data just once while allowing multiple users to access the same data in a personalised view. It does this by dividing the database's physical structure from the user's perspective. The following justifies the desire for this separation:

Different views of the same data are required for different users.
Over time, the method by which a certain user needs to view the data may vary.
Users of the database shouldn't be concerned about the internal operations and physical implementation of the system, including hashing, internal structure optimisation, data compression and encryption methods, etc.
The same data should be accessible to all users based on their needs.

Three Architecture Levels:


The external level of abstraction, which is the highest, addresses how consumers interpret the data. It consists of many external schemas or user views, each customised to meet the requirements of distinct user groups.
Conceptual Level: Often referred to as the logical level, it serves as a user community's representation of the complete database. The conceptual schema, which outlines the limitations and organisation of the data kept in the database, is included in it.

The internal level of abstraction specifies the physical storage of data in a database system. It is the lowest level of abstraction. It contains the internal schema, which describes the database system's actual physical storage configurations and access techniques. 





What is DBMS schema ?
In this context, database design refers to the DBMS schema. Let's use the employee table as an example, for instance. The following characteristics are present in the employee table. EMP_ID, EMP_ADDRESS, EMP_NAME, and EMP_CONTACT are these characteristics. These represent the employee table's schema.

Three extra categories are applied to schemas. These three are listed in order.
PHYSICAL schema.
LOGICAL schema.
VIEW schema.

The database's logical perspective is specified in the schema. It offers some information about the database and the locations of the necessary data.


1. Physical schema: The database is designed at the physical level in the physical schema. The schema at this level explains the management of the storage and the storage of the data block.

2. Logical schema: The database is logically designed in the logical schema. The programmer and data administrator carry out their duties at this level. Additionally, certain data is organised and saved at this level. However, for the suggested security, the internal implementation data are concealed in the physical layer.

3. View schema: The database is created at the view level using view schema. The way users interact with the database system is described in this schema.

What is instance in DBMS?

A database management system (DBMS) instance is a collection of data that is kept for a specific period of time. The characteristics of the database within the specific DBMS are specified by the database schema. An instance of the database management system is defined as the value of a specific attribute at a given point in time.

For instance, we used the attribute of the schema as an example in the example above. Each table in this example has two rows, or two records. The employee table has some instances in the database's schema above because the table has some instances of all the data.


What is Data Independence in DBMS?

  1. Logical Data Independence: Logical data independence refers to the ability to change the conceptual schema without having to change the external schemas or application programs. It allows modifications to the database structure without affecting the way users access the data.

  2. Physical Data Independence: Physical data independence refers to the ability to change the internal schema without affecting the conceptual or external schemas. It allows modifications to the physical storage structures and access methods without impacting the logical structure of the database.

Classification of Database Management System:

  1. Centralized DBMS: In a centralized DBMS architecture, all data is stored and managed in a single location. Users access the database through a single interface, and all data processing tasks are performed centrally.

  2. Client-Server Architecture: In a client-server architecture, the database is stored on a server, and clients communicate with the server to access and manipulate the data. This architecture allows for distributed processing and scalability, as multiple clients can access the database simultaneously.


Types of Client Server Architecture :
1 tier architecture
The presentation, application, and data administration layers are all closely linked into a single system in a one-tier architecture. Small-scale applications where all processing is done on a single machine are the main uses for this architecture.
+------------------------------------+ | Application | | Layer | +------------------------------------+ | Presentation | | Layer | +------------------------------------+ | Data Management | | Layer | +------------------------------------+

2 tier architecture

The application logic in a 2-tier architecture is divided between a client and a server. While the server is in charge of data management and business logic, the client is in charge of the presentation layer and user interaction.The application logic in a 2-tier architecture is divided between a client and a server. While the server is in charge of data management and business logic, the client is in charge of the presentation layer and user interaction.


+------------------------------------+ | Application | | Layer | +------------------------------------+ | Presentation | <----- Client Machine | Layer | +------------------------------------+ | Data Management | <----- Server Machine | Layer | +------------------------------------+

3 tier architecture


The display, application, and data management layers comprise the three divisions of the application logic in a three-tier architecture. Compared to a 2-tier architecture, this one offers greater flexibility and scalability.



+------------------------------------+

|           Application              |

|              Layer                 |

+------------------------------------+

|             Presentation           |      <----- Client Machine

|                Layer               |

+------------------------------------+

|            Business Logic          |      <----- Application Server

|                Layer               |

+------------------------------------+

|          Data Management           |      <----- Database Server

|                Layer               |

+------------------------------------+

what are Data Models? Explain each  Records- based Data Models, Object-based Data Models, Physical Data Models and Conceptual Modeling.



 Conceptual Data Model
The conceptual data model is helpful in understanding the needs and requirements of the database since it provides a high-level description of the database. This approach is employed during the requirement-gathering phase, which is to say, prior to the Database Designers beginning to create a specific database. The entity/relationship model (ER model) is one such well-liked model. Entities, relationships, and even properties that are utilised by database designers are the focus of the E/R model. With regard to this idea, stakeholders and users who are not technical or who do not understand computer science can nevertheless have a conversation and have their needs recognised.

A high-level data model called the Entity-Relationship Model (ER Model) is used to specify the data and the relationships between them. It is essentially a conceptual design for any database that makes creating a data view simple.

Elements of the ER Model:

Real-world objects are referred to as entities. It could be a class, name, location, or item. In an ER Diagram, these are shown by a rectangle.
Attributes: An entity's description is referred to as an attribute. In an ER Diagram, these are represented by an ellipse. For a student, it could be their age, roll number, or marks.
Relationship: Relationships are what establish the connections between various entities. Relationships are represented by rhombuses and diamonds.

OBJECT BASED DATA MODEL 

 In object-based data models, the representation of data is the main concern. The data is separated into a number of entities, each with certain distinguishing features. Furthermore, there exist certain links between these data elements.


Accordingly, the entities in object-based data models are based on real-world models and how the data is really used. The way the data is visualised and integrated is more important than the actual content of the data.

A few instances of object-oriented data models include

 Entity Relationship Data Model

Real-world circumstances are represented as entities in the ER model. In the ER diagram, these entities' characteristics represent their properties, and relationships represent the links between them.

In data designing, an ER model is typically seen as a top-down method.
  

Model of Object-Oriented Data
Object-Oriented Data Model
Using real-world scenarios is also the foundation of object-oriented data models. The scenarios are represented as objects in this model. Objects with comparable functionalities are connected to one another and grouped together.

Here's an illustration of an object-oriented data model:

In this paradigm, there are two objects: PERSON and EMPLOYEE.
Name, address, phone number, and age are properties of PERSON.
The attributes Employee ID, Employee Type, and Department ID are present in EMPLOYEE.


Records- based Data Models

Record-Based Data Model: This type of data model is used when a database is set up with several records in a fixed format. Every record type has a set amount of fields or characteristics, and each field typically has a set length.


Additionally, it is divided into three categories:

Hierarchical Data Model: A group of records serves as the model data's representation in a hierarchical data type. Links in this indicate the relationships between the data. A tree data structure is employed in this concept.
IBM created it in the 1960s to handle massive volumes of data for intricate manufacturing operations. An inverted "tree" represents the fundamental logical structure of a hierarchical data model.



Network Data Model: A group of records serves as the model data representation for networks. Links in this indicate the relationships between the data. In this model, graph data structures are employed. It allows for the existence of several parents on a record.
Take social media platforms like Facebook, Instagram, and so forth.


Relational Data Model: The data and their relationships are represented by tables in the relational data model. Every table has a number of columns, and each one has a distinct name. This model is basic.

 Physical Data Model
It's now time to put a logical model into practice by integrating it into an actual database.
As part of the physical data model, there should be:

A certain DBMS (like Couchbase, for example)
The method(s) used to store data (RAM, disc, hybrid, etc. To combine the speed of RAM with the durability of disc, Couchbase comes with an integrated cache.
Methods for allowing divisions, shards, replications, etc. Partitioning and sharding for Couchbase are automatic processes. A drop-down box for replication allows you to choose the desired number of replicas.
DBAs and/or developers usually construct the physical data model.As part of the physical data model, there should be:

A certain DBMS (like Couchbase, for example)
The method(s) used to store data (RAM, disc, hybrid, etc. To combine the speed of RAM with the durability of disc, Couchbase comes with an integrated cache.


Thursday 15 February 2024

           Binary Search Code in java without recursion

class BinarySearchExample{  

    public static void binarySearch(int arr[], int low, int high, int key){  

        int mid = (low + high)/2;  

        while( low <= high ){  

            if ( arr[mid] < key ){  

                low = mid + 1;     

            } else if ( arr[mid] == key ){  

                System.out.println("Element is found at index: " + mid);  

                break;  

            } else {  

                high = mid - 1;  

            }  

            mid = (low + high)/2;  

        }  

        if ( low > high ){  

            System.out.println("Element is not found!");  

        }  

    }  


    public static void main(String args[]){  

        int arr[] = {15,24,32,35,42,50};  

        int key = 32;  

        int high = arr.length - 1;  

        binarySearch(arr, 0, high, key);     

    }  

}  


OUTPUT

Element is found at index: 2

DataBase Management System Notes

 

                                                  Database Management System (DBMS)

Database Management System (DBMS) is a collection of programs which enables its users to access a database, manipulate data and reporting/representation of data.


Here are some examples of Database Management Systems (DBMS):

  1. MySQL: An open-source relational database management system (RDBMS) widely used in web development and other applications. It's known for its reliability, scalability, and ease of use.

  2. PostgreSQL: Another open-source relational database management system known for its advanced features like full ACID compliance, extensibility, and support for complex queries.

  3. Oracle Database: A commercial relational database management system developed by Oracle Corporation. It's widely used in large enterprises for handling transaction processing, business intelligence, and analytics.

  4. Microsoft SQL Server: A relational database management system developed by Microsoft. It's commonly used in conjunction with Microsoft's .NET framework and is popular in enterprise environments running on Windows servers.

  5. SQLite: A lightweight, self-contained relational database management system that's serverless and doesn't require configuration. It's often used in embedded systems, mobile apps, and small-scale applications.

  6. MongoDB: A NoSQL document-oriented database management system that stores data in flexible, JSON-like documents. It's known for its scalability, high performance, and ease of use in handling unstructured data.

  7. Couchbase: A NoSQL database management system designed for interactive web applications. It's optimized for distributed architecture and offers features like caching, replication, and full-text search.

  8. Redis: An in-memory data structure store often used as a database, cache, and message broker. It's known for its high performance, data structures, and support for various programming languages.

  9. Neo4j: A graph database management system used for storing, querying, and analyzing highly interconnected data. It's commonly used for social networks, recommendation engines, and network analysis.

  10. Amazon DynamoDB: A fully managed NoSQL database service provided by Amazon Web Services (AWS). It's designed for scalability, high performance, and low latency and is often used in cloud-based applications.

These are just a few examples, and there are many other DBMS options available, each with its own set of features, strengths, and use cases.



WHAT is DATABASE?


A database is a structured collection of data organized in a way that allows for efficient storage, retrieval, and manipulation of that data. In a database management system (DBMS), data is typically organized into tables, which consist of rows and columns. Each row represents a single record or instance of data, and each column represents a specific attribute or characteristic of that data.

Databases are used in a wide range of applications and industries to store and manage various types of information, such as customer data, product inventory, financial records, and more. They provide a centralized and structured way to store data, making it easier to access and analyze information when needed.



Advantages of using DBMS:

  1. Data Integration and Centralization: DBMS allows for the integration of data from multiple sources into a single database, providing a centralized location for storing and managing data. This reduces data redundancy and inconsistencies.

  2. Data Security: DBMS provides mechanisms for controlling access to data, ensuring that only authorized users can view or modify sensitive information. It offers features such as user authentication, access control, and encryption to protect data from unauthorized access.

  3. Data Consistency: DBMS enforces data integrity constraints, such as primary key constraints and referential integrity, to maintain the consistency and accuracy of data within the database. This helps prevent data corruption and ensures that the data remains reliable.

  4. Concurrent Access and Transaction Management: DBMS supports concurrent access to the database by multiple users and applications, allowing for simultaneous read and write operations. It also provides transaction management features, such as ACID properties (Atomicity, Consistency, Isolation, Durability), to ensure that transactions are executed reliably and consistently.

  5. Data Recovery and Backup: DBMS offers mechanisms for data backup and recovery, allowing organizations to recover data in the event of hardware failures, system crashes, or other disasters. It enables regular backups and restore operations to minimize data loss and downtime.

  6. Scalability and Performance Optimization: DBMS can scale to accommodate growing amounts of data and increasing numbers of users. It provides features for optimizing database performance, such as indexing, query optimization, and caching, to ensure efficient data retrieval and processing.

Disadvantages of using DBMS:

  1. Cost: Implementing and maintaining a DBMS can be expensive, especially for large-scale deployments. Costs may include licensing fees, hardware infrastructure, personnel training, and ongoing support and maintenance.

  2. Complexity: DBMS can be complex to set up and administer, requiring specialized knowledge and skills. It may involve designing database schemas, optimizing performance, managing security, and troubleshooting issues, which can be challenging for inexperienced users.

  3. Single Point of Failure: DBMS represents a single point of failure, meaning that if the database system goes down, it can disrupt access to critical data and business operations. To mitigate this risk, organizations may need to implement backup and disaster recovery strategies.

  4. Performance Overhead: DBMS introduces overhead in terms of processing and resource utilization, which can impact the performance of applications accessing the database. Factors such as indexing, locking, and transaction management can contribute to latency and reduce throughput.

  5. Vendor Lock-In: Choosing a specific DBMS vendor may lead to vendor lock-in, where organizations become dependent on a particular vendor's technology stack and may face challenges when migrating to alternative solutions in the future.

Overall, while DBMS offers numerous advantages in terms of data management, security, and scalability, organizations should carefully consider the associated costs, complexity, and potential drawbacks before adopting a DBMS solution.


Basic Concepts:

  1. Data:

    • Data refers to raw facts, observations, or symbols that have no meaning on their own.
    • It can be in various forms such as numbers, text, images, sounds, or any other format.
    • Examples of data include individual numbers (e.g., 5, 10), words (e.g., "apple", "banana"), or measurements (e.g., temperature readings, stock prices).
  2. Information:

    • Information is the result of organizing, analyzing, and interpreting data to give it meaning and context.
    • It provides knowledge or insights that can be used for decision-making or understanding a particular subject.
    • For example, if we organize data about sales figures by month and calculate total sales for each month, the resulting information can show trends, patterns, or performance over time.
  3. Records:

    • A record is a collection of related data elements organized and treated as a single unit.
    • It typically represents an entity or object and contains multiple fields (attributes) that describe various aspects of that entity.
    • For example, in a database, a record in a "Customer" table might include fields such as "CustomerID", "Name", "Address", and "Phone Number", each containing specific data about a customer.
  4. Files:

    • A file is a collection of related records or data stored together as a unit on a storage device.
    • It provides a way to organize and store data for easy retrieval and manipulation.
    • Files can be stored in various formats, such as text files, binary files, or multimedia files, depending on the type of data they contain.
    • For example, a text file might contain lines of text representing records in a tabular format, while an image file might contain pixel data representing an image.

In summary, data are raw facts or symbols, information is the meaningful interpretation of data, records are collections of related data elements organized as a unit, and files are collections of related records or data stored together. Together, these concepts form the foundation for organizing, managing, and understanding data in various contexts, such as databases, filesystems, and information systems.


Difference between File system and DBMS

File System:

  1. Data Redundancy: File systems often lead to data redundancy because data is duplicated across multiple files or directories. This can result in inconsistencies and waste storage space.

  2. Limited Data Integrity: File systems have limited built-in mechanisms for ensuring data integrity. Without explicit constraints and validation rules, data integrity may be compromised, leading to errors and inconsistencies.

  3. Limited Query Capabilities: File systems lack built-in query capabilities for retrieving specific subsets of data based on complex conditions. Users typically need to write custom scripts or programs to process and filter data.

  4. Limited Data Sharing: File systems may not provide efficient mechanisms for sharing data across multiple users or applications. Sharing data often involves copying or moving files, which can lead to synchronization issues and data inconsistency.

  5. Limited Security Features: File systems may have limited security features for controlling access to data. Access control lists (ACLs) and permissions are typically applied at the file or directory level, making it difficult to enforce fine-grained access control policies.

Database Management System (DBMS):

  1. Data Integrity Constraints: DBMS enforces data integrity constraints, such as primary key constraints, foreign key constraints, and check constraints, to maintain the consistency and accuracy of data. This helps prevent data corruption and ensures data quality.

  2. Advanced Query Capabilities: DBMS provides advanced query capabilities, including support for complex SQL queries, aggregate functions, joins, subqueries, and indexing. This allows users to retrieve, filter, and analyze data efficiently.

  3. Data Sharing: DBMS supports concurrent access to shared data by multiple users or applications, ensuring data consistency and integrity through transaction management and concurrency control mechanisms.

  4. Backup and Recovery: DBMS offers built-in features for data backup and recovery, including full backups, incremental backups, and point-in-time recovery. This helps protect data against loss or corruption and ensures business continuity.

  5. Data Modeling and Relationships: DBMS allows users to define data models and establish relationships between entities using foreign keys and referential integrity constraints. This facilitates data organization and retrieval based on the inherent relationships between entities.

  6. Data Redundancy Reduction: DBMS employs normalization techniques to minimize data redundancy and improve storage efficiency. By eliminating duplicate data and storing information in a structured manner, DBMS reduces storage space requirements and improves data consistency.

  7. Support for Transactions: DBMS supports transactions, which are units of work that consist of one or more database operations. Transactions ensure that database operations are executed atomically, consistently, isolatedly, and durably (ACID properties), maintaining data integrity and consistency.


                   Database Languages in DBMS

1. Data Definition Language (DDL)

 It is used to define database structure or pattern.

It is used to create schema, tables, indexes, constraints, etc. in the database.

Using the DDL statements, you can create the skeleton of the database.

Data definition language is used to store the information of metadata like the number of tables and schemas, their names, indexes, columns in each table, constraints, etc.

Some tasks that come under DDL:

Create: It is used to create objects in the database.

Alter: It is used to alter the structure of the database.

Drop: It is used to delete objects from the database.

Truncate: It is used to remove all records from a table.

Rename: It is used to rename an object.

Comment: It is used to comment on the data dictionary.


2. Data Manipulation Language (DML)

DML stands for Data Manipulation Language. It is used for accessing and manipulating data in a database. It handles user requests.


Here are some tasks that come under DML:


Select: It is used to retrieve data from a database.

Insert: It is used to insert data into a table.

Update: It is used to update existing data within a table.

Delete: It is used to delete all records from a table.

Merge: It performs UPSERT operation, i.e., insert or update operations.

Call: It is used to call a structured query language or a Java subprogram.

Explain Plan: It has the parameter of explaining data.

Lock Table: It controls concurrency.

3. Data Control Language (DCL)

DCL stands for Data Control Language. It is used to retrieve the stored or saved data.

The DCL execution is transactional. It also has rollback parameters.

Here are some tasks that come under DCL:

Grant: It is used to give user access privileges to a database.

Revoke: It is used to take back permissions from the user.

4. Transaction Control Language (TCL)

TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical transaction.

Here are some tasks that come under TCL:

Commit: It is used to save the transaction on the database.
Rollback: It is used to restore the database to original since the last Commit.


The basic components of a Database Management System (DBMS) environment include:

  1. Hardware:

    • Hardware components form the physical infrastructure necessary to host and run the DBMS software. This includes servers, storage devices, networking equipment, and other computing resources.
  2. Software:

    • DBMS software is the core component that provides the tools and services for managing databases. This includes the DBMS itself, as well as any related software components such as database drivers, client applications, and development tools.
  3. Data:

    • Data is the central focus of the DBMS environment. It consists of the actual information stored within the database, organized into tables, records, and fields according to the database schema.
  4. Users:

    • Users interact with the DBMS to perform various tasks such as querying, updating, and managing data. Users can include database administrators (DBAs), developers, application users, and other stakeholders.
  5. Procedures:

    • Procedures refer to the rules, policies, and processes governing the use and management of the DBMS environment. This includes procedures for database design, data entry, security management, backup and recovery, and performance tuning.
  6. Data:

    • Security mechanisms protect the integrity, confidentiality, and availability of data within the DBMS environment. This includes user authentication, access control, encryption, and auditing features to enforce security policies and prevent unauthorized access.

These six components work together to create a comprehensive environment for managing databases effectively and ensuring the integrity, availability, and security of data within the organization.

DBMS NOTES UNIT 3

                                                              UNIT 3  ER (Entity Relationship) An entity-relationship model is known as an E...