Unit-1(DBMS)
Unit-1(DBMS)
Unit-1(DBMS)
Data Modification: DBMS allows users to insert, update and delete the data
from the tables. These tables contains rows and columns, where row represents
a record of data while column represents attributes of the records. You can also
bulk update the several records in DBMS with a single click.
Data Retrieval: DBMS allows users to fetch data from the database. Searching
and retrieval of data is fast in DBMS. The size of the database doesn’t impact
this operation, on the other hand in file system, the size of the data can hugely
impact the search operation efficiency.
Fast Retrieval of data: Along with storing the data in an optimized and
systematic manner, it is also important that we retrieve the data quickly when
needed. Database systems ensure that the data is retrieved as quickly as
possible.
Database systems are much better than traditional file processing systems.
What is a database?
Data is organized into tables, rows, columns, and index it to make it easier to
find relevant information.
Student_Info
Name( cha Class Roll num Address(Alpha Phone
racters) (Alpha ( Alpha numeric) num( intege
numeric) numeric) r)
GAUTAM CSTA 2021UCB6063 Fdhjguy58709 6789809804
NITIN csta 344587dgf Sdgfh575 5767000878
3. Physical Data Model :
Ultimately, all data in a database is stored physically on a secondary
storage device such as discs and tapes. This is stored in the form of files,
records and certain other data structures. It has all the information of the
format in which the files are present and the structure of the databases,
presence of external data structures and their relation to each other.
Types of Data Model
For the creation of any database, the data model is considered a
logical structure for creating a database. The data model
includes entities, attributes, constraints, relationships, etc. The
data models are used to represent the data and how it is stored
in the database, how data is accessible and updated in the
database management system.
Different Types of Data Models
There are four types of data models: Hierarchical model,
Network model, Entity-relationship model, Relational
model.
1. Hierarchical Model
In this type of data model, the data is organized into a tree-like
structure that has a single root and the data is linked to the root. In
this model, the main hierarchy begins from the root and it expands like
a tree that has child nodes and further expands in the same manner. In
this model the child node has on;e single parent node but one parent
can have multiple child nodes. As the data is stored like tree structure
in this data model when data is retrieved the whole tree is traversed
from the root node. The hierarchical data model contains a one-to-
many relationship between various types of data. The data is stored in
the form of a record and is connected through links.
3. E-R model
The ER model is used to describe the database structure using the
entity-relationship diagram. The E-R model is just like the blueprint of a
database which is used to implement the database. In the entity set,
the relationship exists which can be shown using the ER diagram. The
entity set consists of a similar type of entities that consist of attributes .
The components of the ER model are relationship set and entity set
and attributes. The entity is the component of data which is
represented as a rectangle in the ER diagram. For example, there are
two entities: college and student and there exist one too many
relationships as there can be more than one student who can go to
college.
4. Relational model
In this data model, the data tables are used to collect a group of
elements into the relations. In this model, the relationships and
data are represented using interrelated tables. And in the table,
there are multiple rows and multiple columns in which column
represents the attribute of the entity and the rows are used to
represent records. In this data model there exist different primary key
which issued to distinguish each record in the table. And for retrieving
the data elements the SQL (Structured Query Language) is used.
For using the relational data model the primary key issued as the
fundamental tool. And for each entry in the data set, it needs to be
unique. The data table should not contain any type of inconsistency as
it can create a problem at the time of data retrieval. The other problem
with the relational data model is data duplicacy, incomplete data and
inappropriate links used to connect data.
The Database Management System (DBMS) architecture shows how data in the
database is viewed by the users. It is not concerned about how the data are handled
and processed by the DBMS.
It helps in implementation, design, and maintenance of a database to store and
organize information for companies. The concept of DBMS depends upon its
architecture. The architecture can be designed as centralized, decentralized, or
hierarchical. The architecture of DBMS can be defined at three levels as follows −
External levels.
Conceptual levels.
Internal levels.
The main objective of the three level architecture is nothing but to separate each user
view of the data from the way the database is physically represented. The database
internal structure should be unaffected while changes to the physical aspects of
storage.
The DBA should be able to change the conceptual structure of the database without
affecting all other users.
Components of a ER Diagram
1. Entity
An entity is an object or component of data. An entity is represented as rectangle
in an ER diagram.
For example: In the following ER diagram we have two entities Student and
College and these two entities have many to one relationship as many students
study in a single college. We will read more about relationships later, for now
focus on entities.
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the
relationship with other entity is called weak entity. The weak entity is represented
by a double rectangle. For example – a bank account cannot be uniquely
identified without knowing the bank to which the account belongs, so bank
account is a weak entity.
2. Attribute
An attribute describes the property of an entity. An attribute is represented as
Oval in an ER diagram. There are four types of attributes:
1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute
1. Key attribute:
A key attribute
can uniquely identify an entity from an entity set. For example, student roll
number can uniquely identify a student from a set of students. Key attribute is
represented by oval same as other attributes however the text of key attribute
is underlined.
2. Composite attribute:
An attribute that
is a combination of other attributes is known as composite attribute. For example,
In student entity, the student address is a composite attribute as an address is
composed of other attributes such as pin code, state, country.
3. Multivalued attribute:
An attribute that can hold multiple values is known as multivalued attribute. It is
represented with double ovals in an ER Diagram. For example – A person can
have more than one phone numbers so the phone number attribute is
multivalued.
4. Derived attribute:
A derived attribute is one whose value is dynamic and derived from another
attribute. It is represented by dashed oval in an ER Diagram. For example –
Person age is a derived attribute as it changes over time and can be derived
from another attribute (Date of birth).
3. Relationship
A relationship is represented by diamond shape in ER diagram, it shows the
relationship among entities.
Entity
Relationship Diagram – ER Diagram in DBMS
BY CHAITANYA SINGH | FILED UNDER: DBMS
An Entity–relationship model (ER model) describes the structure of a
database with the help of a diagram, which is known as Entity Relationship
Diagram (ER Diagram). An ER model is a design or blueprint of a database that
can later be implemented as a database. The main components of E-R model
are: entity set and relationship set.
A simple ER Diagram:
In the following diagram we have two entities Student and College and their
relationship. The relationship between Student and College is many to one as a
college can have many students however a student cannot study in multiple
colleges at the same time. Student entity has attributes such as Stu_Id,
Stu_Name & Stu_Addr and College entity has attributes such as Col_ID &
Col_Name.
Here are the geometric shapes and their meaning in an E-R Diagram. We will
discuss these terms in detail in the next section(Components of a ER Diagram)
of this guide so don’t worry too much about these terms now, just go through
them once.
Rectangle: Represents Entity sets.
Ellipses: Attributes
Diamonds: Relationship Set
Lines: They link attributes to Entity Sets and Entity sets to Relationship Set
Double Ellipses: Multivalued Attributes
Dashed Ellipses: Derived Attributes
Double Rectangles: Weak Entity Sets
Double Lines: Total participation of an entity in a relationship set
A DBMS contains one database and along with that it also contains
metadata about that one database.
Metadata is the data about data. For example: In a DBMS for a particular
School, the total Number of rows in the database and what is the name of
each column of the database table, and all such information about the data
is metadata.
So, the combination of this database and metadata leaves no questions in
anyone’s mind as the DBMS becomes self-explanatory. This is because
the database has all the information in a structured format and if anyone
has any doubts or questions regarding how the database is designed, they
may look into the metadata.
Multiple users can access the database at the same time without any
anomalies (problems: like 2 people trying to access the same data might
restrict one from accessing it).
For instance: Again, let us consider the database of a bank where a
person Rohan has his account. Let us say that Rohan has a brother Neil
and he gives Neil his ATM card to withdraw some cash from the ATM.
Now, when Neil reached the ATM, at the same time Rahul asked Rohan to
transfer 1000 Rupees to him. If Rohan’s initial balance was rupees 5000
and he transfers rupees 1000 to Rahul and he asks Neil to withdraw 2000
Rupees, his balance should now be Rupees 2000 (5000-3000).
If the users would not have concurrent access to the database, either
Neil’s transaction or Rohan’s transaction would have taken place and
instead of 3000 Rupees, only 1000 or 2000 rupees would have been less
from Rohan’s account.
Thus, we see that concurrent access is such a great characteristic of
DBMS.
Integrity means that the data which comes into the Database should be
correct as well as consistent. Let us see an example to understand the
meaning of correct and consistent data with respect to DBMS.
For instance: Let us say that there is an XYZ bank and its has its own
database of all the customers of the bank. If we are entering the details of
XYZ Bank’s account and the account number is not specific to that
bank, the data is incorrect. However, if a person has changed his/her
address in the savings account of the same Bank and the current account
still has the old address of the person in the current account’s details, this
is data inconsistency.
In DBMS, the data that is entered into the database is both correct as well
as consistent. Apart from that, integrating changes is very easy in a
database.
For instance, if the bank earlier had a constraint of having a minimum
account balance of 0 and now it has changed it to 2000 Rupees, the
DBMS will be able to integrate this change very easily and all the accounts
that do not have a minimum balance of 2000 will be detected and notified
accordingly.
Before DBMS, the conventional file system (i.e. files and folders) was used
to store complex and large data.
Searching for a Name in thousands of Students was a very difficult task.
This is because manual searching is done in a conventional file system for
a particular data. However, DBMS provides ease of access to the data
inside the database.
We can run a search query to find any data and the process is way faster
than manual searching and is more reliable.
The CRUD (Create, Read, Update & Delete) operations are very easy to
perform with a database because of the DBMS queries.
9. ACID Properties
Database Instance
It is important that we distinguish these two terms individually. Database schema is the
skeleton of database. It is designed when the database doesn't exist at all. Once the
database is operational, it is very difficult to make any changes to it. A database
schema does not contain any data or information.
A database instance is a state of operational database with data at any given time. It
contains a snapshot of the database. Database instances tend to change with time.
Different types of Database Users
Database users are categorized based up on their interaction with the data
base.
These are seven types of data base users in DBMS.
1. Database Administrator (DBA) :
Database Administrator (DBA) is a person/team who defines the schema
and also controls the 3 levels of database.
The DBA will then create a new account id and password for the user if
he/she need to access the data base.
DBA is also responsible for providing security to the data base and he allows
only the authorized users to access/modify the data base.
DBA also monitors the recovery and back up and provide technical
support.
The DBA has a DBA account in the DBMS which called a system or
superuser account.
DBA repairs damage caused due to hardware and/or software failures.
3. System Analyst :
System Analyst is a user who analyzes the requirements of parametric end
users. They check whether all the requirements of end users are satisfied.
4. Sophisticated Users :
Sophisticated users can be engineers, scientists, business analyst, who are
familiar with the database. They can develop their own data base
applications according to their requirement. They don’t write the program
code but they interact the data base by writing SQL queries directly through
the query processor.
6. Application Program :
Application Program are the back end programmers who writes the code for
the application programs.They are the computer professionals. These
programs could be written in Programming languages such as Visual Basic,
Developer, C, FORTRAN, COBOL etc.