0% found this document useful (0 votes)
9 views

Databases 3

An RDBMS is a type of database management system that stores data in tables with rows and columns. It uses SQL and connects related data elements. An RDBMS maintains data security, accuracy, integrity and consistency. It is the most popular database system and includes functions like SQL Server, Oracle, and MySQL. An RDBMS stores data in tables that can be queried and updated using languages like SQL.

Uploaded by

Shahzeb Bashir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Databases 3

An RDBMS is a type of database management system that stores data in tables with rows and columns. It uses SQL and connects related data elements. An RDBMS maintains data security, accuracy, integrity and consistency. It is the most popular database system and includes functions like SQL Server, Oracle, and MySQL. An RDBMS stores data in tables that can be queried and updated using languages like SQL.

Uploaded by

Shahzeb Bashir
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Course: Database Management System

Lecture # 3
What is RDBMS (Relational Database Management System)

An RDBMS is a type of database management


system (DBMS) that stores data in a row-based
table structure which connects related data
elements. An RDBMS includes functions that
maintain the security, accuracy, integrity and
consistency of the data. This is different than the
file storage used in a DBMS.
What is RDBMS (Relational Database Management System)

• A relational database management system


(RDBMS) is a collection of programs and
capabilities that enable IT teams and others to
create, update, administer and otherwise
interact with a relational database. RDBMS
store data in the form of tables, with most
commercial relational database management
systems using Structured Query
Language (SQL) to access the database.
What is RDBMS (Relational Database Management System)

• The RDBMS is the most popular database


system among organizations across the world.
It provides a dependable method of storing
and retrieving large amounts of data while
offering a combination of system performance
and ease of implementation.
What is RDBMS (Relational Database Management System)

• All modern database management systems like


SQL, MS SQL Server, IBM DB2, ORACLE, My-
SQL, and Microsoft Access are based on RDBMS.

It is called Relational Database Management


System (RDBMS) because it is based on the
relational model introduced by E.F. Codd.
What is RDBMS (Relational Database Management System)

• The most basic RDBMS functions are related


to create, read, update and delete operations -
- collectively known as CRUD. The RDBMS
typically provides data dictionaries and
metadata collections that are useful in data
handling. These programmatically support
well-defined data structures and
relationships.
How RDBMS works
Before creating these tables, the RDBMS must
check the following constraints:
• RDBMS will store data in the form of a table.
Each system will have varying numbers of
tables with each table possessing its own
unique primary key. The primary key is then
used to identify each table.
• Within the table are rows and columns. The
rows are known as records or horizontal
entities; they contain the information for the
individual entry. The columns are known as
vertical entities and possess information about
the specific field.
How RDBMS works
• Primary keys -- this identifies each row in the
table. One table can only contain one primary key.
The key must be unique and without null values.
• Foreign keys -- this is used to link two tables. The
foreign key is kept in one table and refers to the
primary key associated with another table.
• Not null -- this ensures that every column does not
have a null value, such as an empty cell.
• Check -- this confirms that each entry in a column
or row satisfies a precise condition and that every
column holds unique data.
• Data integrity -- the integrity of the data must be
confirmed before the data is created.
RDBMS (Relational Database Management System)

Following are the various terminologies of RDBMS:


RDBMS (Relational Database Management System)

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.
RDBMS (Relational Database Management System)

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 The tuples of a relation have no specific order.

o All attributes in a relation are atomic, i.e.,


each cell of a relation contains exactly one
value.
RDBMS (Relational Database Management System)
Example of the student table.

Student
Roll No Name AGE COURSE

1 A 24 BS

2 B 20 C.A

3 C 21 BCA

4 D 22 MCA

5 E 26 BSC
RDBMS (Relational Database Management System)

What is a row or record?

• A row of a table is also called a record or tuple. It contains the


specific information of each entry in the table. It is a horizontal entity
in the table. For example, The above table contains 5 records.

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.
RDBMS (Relational Database Management System)

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 previous slide 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 Null values are permitted for the attributes.

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.
RDBMS (Relational Database Management System)

What is data item/Cells?

• The smallest unit of data in the table is the individual data item. It is stored
at the intersection of tuples and attributes.

Properties of data items:

o Data items are atomic.

o The data items for an attribute should be drawn from the same domain.

o In the below example, the data item in the student table consists of 1, A, 24
and BS etc..

ID Name AGE COURSE

1 A 24 BS
RDBMS (Relational Database Management System)

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.

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.

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.
RDBMS (Relational Database Management System)

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.

Data Integrity

There are the following categories of data integrity exist with each RDBMS:

• Entity integrity: It specifies that there should be no duplicate rows in a table.

• Domain integrity: It enforces valid entries for a given column by restricting the
type, the format, or the range of values.

• Referential integrity specifies that rows cannot be deleted, which are used by other
records.

• User-defined integrity: It enforces some specific business rules defined by users.


These rules are different from the entity, domain, or referential integrity.
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
DBMS RDBMS
DBMS applications store data as file. RDBMS applications store data in a tabular form.

In DBMS, data is generally stored in either a In RDBMS, the tables have an identifier called primary key and the
hierarchical form or a navigational form. data values are stored in the form of tables.

Normalization is not present in DBMS. Normalization is present in RDBMS.

DBMS does not apply any security with regards to RDBMS defines the integrity constraint for the purpose of ACID
data manipulation. (Atomocity, Consistency, Isolation and Durability) property.

DBMS uses file system to store data, so there will in RDBMS, data values are stored in the form of tables, so
be no relation between the tables. a relationship between these data values will be stored in the form
of a table as well.

DBMS has to provide some uniform methods to RDBMS system supports a tabular structure of the data and a
access the stored information. relationship between them to access the stored information.

DBMS does not support distributed database. RDBMS supports distributed database.

DBMS is meant to be for small organization and deal RDBMS is designed to handle large amount of data. it
with small data. it supports single user. supports multiple users.

Examples of DBMS are file systems, xml etc. Example of RDBMS are mysql, postgre, sql server, oracle etc.
Database Languages in DBMS
o A DBMS has appropriate languages and interfaces to express database
queries and updates.
o Database languages can be used to read, store and update the data in the
database.

Types of Database Languages


Database Languages in DBMS
Data Definition Language (DDL)
statements are used to classify the database structure or
schema. It is a type of language that allows the DBA or user
to depict and name those entities, attributes, and
relationships that are required for the application along with
any associated integrity and security constraints. Here are
the lists of tasks that come under DDL:
• CREATE - used to create objects in the database
• ALTER - used to alters the structure of the database
• DROP - used to delete objects from the database
• TRUNCATE - used to remove all records from a table,
including all spaces allocated for the records are removed
• COMMENT - used to add comments to the data
dictionary
• RENAME - used to rename an object
Database Languages in DBMS
Data Manipulation Language (DML)
A language that offers a set of operations to support the
fundamental data manipulation operations on the data held
in the database. Data Manipulation Language (DML)
statements are used to manage data within schema objects.
Here are the lists of tasks that come under DML:
• SELECT - It retrieves data from a database
• INSERT - It inserts data into a table
• UPDATE - It updates existing data within a table
• DELETE - It deletes all records from a table, the space for
the records remain
• MERGE - UPSERT operation (insert or update)
• CALL - It calls a PL/SQL or Java subprogram
• EXPLAIN PLAN - It explains the access path to data
• LOCK TABLE - It controls concurrency
Database Languages in DBMS

Data Control Language (DCL)

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

o The DCL execution is transactional. It also has rollback parameters. (But in


Oracle database, the execution of data control language does not have the
feature of rolling back.) Here are some tasks that come under DCL:

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

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

• There are the following operations which have the authorization of Revoke:

CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT


Database Languages in DBMS
Transaction Control Language (TCL)
• Transaction Control statements are used to run
the changes made by DML statements. It
allows statements to be grouped into logical
transactions.
• COMMIT - It saves the work done
• SAVEPOINT - It identifies a point in a
transaction to which you can later roll back
• ROLLBACK - It restores the database to
original since the last COMMIT
ER (Entity Relationship) Diagram in DBMS

o ER model stands for an Entity-Relationship model. It is a high-


level data model. This model is used to define the data
elements and relationship for a specified system.

o It develops a conceptual design for the database. It also


develops a very simple and easy to design view of data.

o In ER modeling, the database structure is portrayed as a


diagram called an entity-relationship diagram.

• For example, Suppose we design a school database. In this


database, the student will be an entity with attributes like
address, name, id, age, etc.
ER (Entity Relationship) Diagram in DBMS
ER (Entity Relationship) Diagram in DBMS
Component of ER Diagram
ER (Entity Relationship) Diagram in DBMS
Entity:

• An entity may be any object, class, person or place. In the ER diagram, an


entity can be represented as rectangles.

• Consider an organization as an example- manager, product, employee,


department etc. can be taken as an entity.

Weak Entity:

• An entity that depends on another entity called a weak entity. The weak
entity doesn't contain any key attribute of its own. The weak entity is
represented by a double rectangle.
ER (Entity Relationship) Diagram in DBMS
Attribute
• The attribute is used to describe the property of an
entity. Eclipse is used to represent an attribute.
• For example id, age, contact number, name, etc. can
be attributes of a student.
ER (Entity Relationship) Diagram in DBMS

Key Attribute

• The key attribute is used to represent the main


characteristics of an entity. It represents a primary key.
The key attribute is represented by an ellipse with the
text underlined.
ER (Entity Relationship) Diagram in DBMS

Composite Attribute

An attribute that composed of many other attributes is


known as a composite attribute. The composite attribute
is represented by an ellipse, and those ellipses are
connected with an ellipse.
ER (Entity Relationship) Diagram in DBMS
Multivalued Attribute
• An attribute can have more than one value. These attributes are known as a
multivalued attribute. The double oval is used to represent multivalued attribute.
• For example, a student can have more than one phone number.

Derived Attribute
• An attribute that can be derived from other attribute is known as a derived attribute.
It can be represented by a dashed ellipse.
• For example, A person's age changes over time and can be derived from another
attribute like Date of birth.
ER (Entity Relationship) Diagram in DBMS
Relationship
• A relationship is used to describe the relation between entities. Diamond symbol is
used to represent the relationship.

Types of relationship are as follows:


a. One-to-One Relationship
• When only one instance of an entity is associated with the relationship, then it is
known as one to one relationship.
• For example, An Employee assigned one parking space.
ER (Entity Relationship) Diagram in DBMS
One-to-many relationship

• When only one instance of the entity on the left, and more than one instance of an
entity on the right associates with the relationship then this is known as a one-to-many
relationship.

• For example, Scientist can invent many inventions, but the invention is done by the
only specific scientist.
ER (Entity Relationship) Diagram in DBMS

Many-to-one relationship

• When more than one instance of the entity on the left, and only
one instance of an entity on the right associates with the
relationship then it is known as a many-to-one relationship.

• For example, Student enrolls for only one course, but a course
can have many students.
ER (Entity Relationship) Diagram in DBMS
Many-to-many relationship

• When more than one instance of the entity on the left, and more than one instance
of an entity on the right associates with the relationship then it is known as a many-to-
many relationship.

• For example, Employee can assign by many projects and project can have many
employees.
ER (Entity Relationship) Diagram in DBMS
Notation of ER diagram
• Database can be represented using the notations. In ER diagram, many notations are
used to express the cardinality. These notations are as follows:

You might also like