Database - Intro 1
Database - Intro 1
The database is a collection of inter-related data which is used to retrieve, insert and delete the data
efficiently. It is also used to organize the data in the form of a table, schema, views, and reports, etc.
For example: The college Database organizes the data about the admin, staff, students and faculty etc.
Applications of DBMS
DBMS are used almost in every software that we use. For example, Emails, WhatsApp, Social Media
and in-fact this article that you are reading is being stored and accessed using DBMS. Almost all
programming languages provide libraries from different popular database management systems like
MySQL, Oracle, Microsoft SQL Server, MongoDB, etc.
• Redundancy of data: Data is said to be redundant if the same data is copied at many places.
If a student wants to change their Phone number, he or she has to get it updated in various
sections. Similarly, old records must be deleted from all sections representing that student.
• Inconsistency of Data: Data is said to be inconsistent if multiple copies of the same data do
not match each other. If the Phone number is different in Accounts Section and Academics
Section, it will be inconsistent. Inconsistency may be because of typing errors or not updating
all copies of the same data.
• Difficult Data Access: A user should know the exact location of the file to access data, so the
process is very cumbersome and tedious. If the user wants to search the student hostel
allotment number of a student from 10000 unsorted students’ records, how difficult it can be.
• Unauthorized Access: File Systems may lead to unauthorized access to data. If a student gets
access to a file having his marks, he can change it in an unauthorized way.
• No Concurrent Access: The access of the same data by multiple users at the same time is
known as concurrency. The file system does not allow concurrency as data can be accessed by
only one user at a time.
• No Backup and Recovery: The file system does not incorporate any backup and recovery of
data if a file is lost or corrupted.
Advantages of DBMS
• Data organization: A DBMS allows for the organization and storage of data in a structured
manner, making it easy to retrieve and query the data as needed.
• Data integrity: A DBMS provides mechanisms for enforcing data integrity constraints, such as
constraints on the values of data and access controls that restrict who can access the data.
• Concurrent access: A DBMS provides mechanisms for controlling concurrent access to the
database, to ensure that multiple users can access the data without conflicting with each
other.
• Data security: A DBMS provides tools for managing the security of the data, such as controlling
access to the data and encrypting sensitive data.
• Backup and recovery: A DBMS provides mechanisms for backing up and recovering the data
in the event of a system failure.
• Data sharing: A DBMS allows multiple users to access and share the same data, which can be
useful in a collaborative work environment.
Disadvantages of DBMS
• Complexity: DBMS can be complex to set up and maintain, requiring specialized knowledge
and skills.
• Performance overhead: The use of a DBMS can add overhead to the performance of an
application, especially in cases where high levels of concurrency are required.
• Scalability: The use of a DBMS can limit the scalability of an application, since it requires the
use of locking and other synchronization mechanisms to ensure data consistency.
• Cost: The cost of purchasing, maintaining and upgrading a DBMS can be high, especially for
large or complex systems.
• Limited Use Cases: Not all use cases are suitable for a DBMS, some solutions don’t need high
reliability, consistency or security and may be better served by other types of data storage.
Types of Databases
• There are various types of databases used for storing different varieties of data:
1) Relational Database
This database is based on the relational data model, which stores data in the form of rows(tuple) and
columns(attributes), and together forms a table(relation). A relational database uses SQL for storing,
manipulating, as well as maintaining the data. E.F. Codd invented the database in 1970. Each table in
the database carries a key that makes the data unique from others. Examples of Relational databases
are MySQL, Microsoft SQL Server, Oracle, etc.
2) Hierarchical Databases
It is the type of database that stores data in the form of parent-children relationship nodes. Here, it
organizes data in a tree-like structure.
Data get stored in the form of records that are connected via links. Each child record in the tree will
contain only one parent. On the other hand, each parent record can have multiple child records.
3) Network Databases
It is the database that typically follows the network data model. Here, the representation of data is in
the form of nodes connected via links between them. Unlike the hierarchical database, it allows each
record to have multiple children and parent nodes to form a generalized graph structure.
A relational database is the most commonly used database. It contains several tables, and each table
has its primary key.
Due to a collection of an organized set of tables, data can be accessed easily in RDBMS.
What is table/Relation?
Everything in a relational database is stored in the form of relations. The RDBMS database uses tables
to store data. A table is a collection of related data entries and contains rows and columns to store
data. Each table represents some real-world objects such as person, place, or event about which
information is collected. The organized collection of data into a relational table is known as the logical
view of the database.
Properties of a Relation:
o Each relation has a unique name by which it is identified in the database.
o Relation does not contain duplicate tuples.
o All attributes in a relation are atomic, i.e., each cell of a relation contains exactly one value.
1 Ajeet 24 B.Tech
2 aryan 20 C.A
3 Mahesh 21 BCA
4 Ratan 22 MCA
5 Vimal 26 BSC
Properties of a row:
o No two tuples are identical to each other in all their entries.
o All tuples of the relation have the same format and the same number of entries.
o The order of the tuple is irrelevant. They are identified by their content, not by their position.
1 Ajeet 24 B.Tech
What is a column/attribute?
A column is a vertical entity in the table which contains all information associated with a specific field
in a table. For example, "name" is a column in the above table which contains all information about a
student's name.
Properties of an Attribute:
o Every attribute of a relation must have a name.
o Default values can be specified for an attribute automatically inserted if no other value is
specified for an attribute.
o Attributes that uniquely identify each tuple of a relation are the primary key.
Name
Ajeet
Aryan
Mahesh
Ratan
Vimal
o The data items for an attribute should be drawn from the same domain.
In the below example, the data item in the student table consists of Ajeet, 24 and Btech, etc.
1 Ajeet 24 B.Tech
Degree:
The total number of attributes that comprise a relation is known as the degree of the table.
For example, the student table has 4 attributes, and its degree is 4.
1 Ajeet 24 B.Tech
2 aryan 20 C.A
3 Mahesh 21 BCA
4 Ratan 22 MCA
5 Vimal 26 BSC
Cardinality:
The total number of tuples at any one time in a relation is known as the table's cardinality. The relation
whose cardinality is 0 is called an empty table.
For example, the student table has 5 rows, and its cardinality is 5.
1 Ajeet 24 B.Tech
2 aryan 20 C.A
3 Mahesh 21 BCA
4 Ratan 22 MCA
5 Vimal 26 BSC
Domain:
The domain refers to the possible values each attribute can contain. It can be specified using standard
data types such as integers, floating numbers, etc. For example, an attribute entitled Marital_Status
may be limited to married or unmarried values.
NULL Values
The NULL value of the table specifies that the field has been left blank during record creation. It is
different from the value filled with zero or a field that contains space.
Difference between DBMS and RDBMS
Although DBMS and RDBMS both are used to store information in physical database but there are
some remarkable differences between them.
The main differences between DBMS and RDBMS are given below:
Examples of DBMS are file Example of RDBMS are mysql, postgre, sql
8)
systems, xml etc. server, oracle etc.
After observing the differences between DBMS and RDBMS, you can say that RDBMS is an extension
of DBMS. There are many software products in the market today who are compatible for both DBMS
and RDBMS. Means today a RDBMS application is DBMS application and vice-versa.
There are the following differences between DBMS and File systems:
o Physical Data
Independence
DBMS Architecture
o The DBMS design depends upon its architecture. The basic client/server architecture is used
to deal with a large number of PCs, web servers, database servers and other components that
are connected with networks.
o The client/server architecture consists of many PCs and a workstation which are connected via
the network.
o DBMS architecture depends upon how users are connected to the database to get their
request done.
Types of DBMS Architecture
Database architecture can be seen as a single tier or multi-tier. But logically, database architecture is
of two types like: 2-tier architecture and 3-tier architecture.
1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user can directly
sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't provide a handy
tool for end users.
o The 1-Tier architecture is used for development of the local application, where programmers
can directly communicate with the database for the quick response.
2-Tier Architecture
o The 2-Tier architecture is same as basic client-server. In the two-tier architecture, applications
on the client end can directly communicate with the database at the server side. For this
interaction, API's like: ODBC, JDBC are used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query processing and
transaction management.
o To communicate with the DBMS, client-side application establishes a connection with the
server side.
Fig: 2-tier Architecture
3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server. In this
architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which further
communicates with the database system.
o End user has no idea about the existence of the database beyond the application server. The
database also has no idea about any other user beyond the application.
Instance:
An instance of the database is also called a database state. It is the data in the database at any given
point of time. Every time any modifications such as update, insert and delete operation are performed
on the database, the database changes from one state to another.