Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

to our Presentation

Course Title: Introduction to Computer Science and IT


Course Code: CSE-1101
Database Management
System
Introducing Members

ID:B210305042 ID:B210305048 ID:B210305049


Shamima Akther Borna Maruf Khan Farhana Yesmin Riya
What is Database?

A database is a collection of
interrelated data that is typically
stored in a computer system.
Database Management System
(DBMS)

A software or a collection of programs that


enables users to
• Create database
• Manage and maintain database
• Storing data
• Retrieval of data
Functionalities of DBMS

Define Construct Manipulate Share

• Specifying • Process of • Querying • Allows


data type, storing data the multiple
structure, on some database to users and
constraints storage retrieve, programs to
medium update and access
generate concurrently
Example

STUDENT

Name Roll Class Major

Proyash 01 1.2 CSE

Prottoy 18 1.1 CSE

Strings of Character Int Float Strings of Character


Database System Environment

Users/Programmers

Application Programs/Queries

Software to Process Queries/Programs

Software to Access Stored Data


Meta Data Stored Database
Characteristics of DBMS Approach

➢ Self-Describing Nature of a DB System


➢ Insulation between Programs and Data
➢ Program-Data Independence
➢ Data Abstraction
➢ Data Model
➢ Support of Multiple Views of the Data
➢ Sharing of Data and Multiuser Transaction Processing
➢ Concurrency Control
➢ OLTP
DBMS Transaction Properties

Isolation Atomicity
• A property that defines how or when the • A property which ensures that the
changes made by one operation become transaction is either fully completed or
visible to others. none at all.
DATABASE USERS

Actors on the Scene Workers behind the Scene

• Database Administrators • System Designers and Implementers


• Database Designers • Tool Developers
• End Users • Operator and Maintenance Personnel
• System Analyst and Application
Programmers / Software Engineers
ADVANTAGES OF DBMS

• Controlling Redundancy
• Restricting Unauthorized Access
• Providing Persistent Storage for Program Objects
• Providing Storage Structures for Efficient Query Processing
• Providing Backup and Recovery
• Providing Multiple User Interfaces
• Representing Complete Relationships among Data
• Enforcing Integrity Constraints
• Permitting Inferencing and Actions using Rules
DATA MODEL

Categories:
➢ High-level or conceptual data models
➢ Representational or implementation data models
➢ Low-level data models
DATABASE SCHEMA
DEFINITION:
• Description of a database
• Plan or layout or blueprint of the database
• Subset of Metadata

SCHEMA DIAGRAM: Diagrammatic representation of schema or displayed


schema.
STUDENT

NAME ROLL BRANCH ADDRESS

SCHEMA CONSTRUCT: Each object within the schema


Example: Table in a database (STUDENT)
THREE SCHEMA ARCHITECTURE

3 LEVELS:
• Internal Level
• Conceptual Level
• External Level

DATA INDEPENDENCE:
➢ Logical Data Independence
➢ Physical Data Independence
DATABASE LANGUAGES
DDL DML

• DATA DEFINITION LANGUAGE • DATA MANIPULATION LANGUAGE


• Defines the internal and • Manipulates data in the database
conceptual schemas
• Two types of DML:
• Others:
• High-level / Non-procedural
• SDL
DML
• VDL
• Low-level / Procedural DML
Introduction to Database
System Architectures.
Database System Architectures

The journey from big mainframe to pc has also evolved the database and its
architecture.

• Classification:

❑ Centralized DBMS Architecture

❑ Client-Server Architecture

❑ Distributed Databases
1.Centralized DBMS Architecture

❑ Traditional form, all data, functionality, apps are located on one machine

❑ Access via communication links. Access via communication links.

2.Client-Server Architecture

❑ Involves a client and a server.

❑Clients are PCs or workstations.

❑Servers are powerful computers, can manage files, printers, e-mails.

❑Client interacts server when additional functionality doesn't exits in its own machine.
3.Distributed Database Architecture

❑Decentralized functionality, distributed among


many computers.

❑Storage computers are at diff. geographical


locations.
Introduction to Entity-
Relationship Model?
About-ER.MODEL
❑Entity relationship model also called e-r model and it is a high level model.

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

❑lt develops a conceptual design for the database. It also develops a very simple and easy to
design view of data.

❑In ER modeling, the database structure is portrayed as a diagram called an entity-


relationship diagram.
address
name

EXAMPLE- Student

id age
Component of ER Diagram -
ER Model

Entity Attribute Relation


Weak Entity Key Attribute One to One

Composite Attribute One to Many

Multi valued Attribute Many to One

Derived Attribute Many to Many


➢Entity-
❑An entity may be any object, class, person or place

❑ In the ER diagram, an entity can be represented as rectangles.

Department
Employee Works for D

➢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. Loan installment

❑The weak entity is represented by a double rectangle.


➢Attribute-
❑The attribute is used to describe the property of an entity.

❑For example - id, age, contact number, name, etc. can be attributes of a student.
id Phone_n
o

Student
name age

➢Key Attribute-
❑The key attribute is used to represent the main characteristics of an entity.

❑lt represents a primary key.

❑The key attribute is represented by an oval shape with the text underlined.
Phone_n
id
o
Student

name age
➢Composite Attribute- Name

❑An attribute that composed of many other


attributes is known as a composite attribute Last_N
First_N Middle
ame
ame _name

Multivalued Attribute-
❑An attribute can have more than one value.

❑These attributes are known as a multivalued attribute. Phone_no

❑The double oval is used to represent multivalued attribute.


➢Derived Attribute-

❑An attribute that can be derived from other attribute is known


as a derived attribute.

❑It can be represented by a dashed oval.

Birth date
Name

Student

Age
Roll_no
➢ Relationship-
❑ A relationship is used to describe the relation between
entities.

❑ Diamond shape is used to represent the relationship.

❑ There are two types one is strong relation and second is weak
relation.

❑ strong relationship represented by a single diamond where


weak relationship represented by double diamond
➢Types of relationship-
1.0ne-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, A female can marry to one male and a male can marry to one female.

2.0ne-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.
3.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.

4.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.
Introduction to Relational
Database Model?
➢RELATIONAL MODEL

The most popular data model in DBMS is the Relational Model. It is more
scientific a model than others.

The main highlights of this model are-

❑Data is stored in tables called relations

❑Relations can be normalized.

❑Each row in a relation contains a unique value.

❑Each column in a relation contains values from a same domain.


attributes Column

SID SNAME SAGE SCLASS SSECTION

1101 Riyan 21 10 A

1102 Nabil 22 9 A

1103 Mehedi 20 11 B

1104 Zihad 23 8 B

1105 Arman 19 12 A
tuple

Table (relation)
Properties of Relational Tables:
❑Values Are Atomic Each Row is Unique.

❑Column Values Are of the Same Kind.

❑The Sequence of Columns is


Insignificant.

❑The Sequence of Rows is Insignificant.

❑ Each Column Has a Unique Name.


Common DBMS Software

• Oracle • MongoDB
• Microsoft SQL Server • SQLite
• MySQL • Firebase
• DB2 • MariaBD
• PostgreSQL • Couchbase
SQL (STRUCTURED QUERY LANGUAGE)

• Standardized Computer Language


• Manages data in RDBMS
• Common uses are:
• Data Querying
• Data Modification
• Data integrity
• Data Migration
EXAMPLE OF SQL DATABASE
CUSTOMERS

customer_id first_name last_name age country


1 John Doe 25 USA

2 Robert Britt 18 UK

3 Betty Doe 12 UK

4 David Sailor 34 UAE

5 John Cena 55 USA

age country
SELECT age, country
FROM CUSTOMERS; 25 USA
WHERE country=‘USA’; 55 USA
Introduction to RDBMS
OPERATORS
Intersection

Division Selection

RDBMS
Cartesian Projection

OPERATORS

Difference Join

Union
UNION

Sale 2005 Sale 2006


Name Amount NAME AMMOUNT

Atasi 9000 Atasi 15000

Riyan 1000 Riyan 1000

Nabil 500 Apshora 2500

Yields Query like this

NAME AMMOUNT

SELECT * FROM sales 2005 Atasi 9000


Union Riyan 1000
SELECT * FROM sales2006
Nabil 500

Atasi 15000

Apshora 2500
Intersection

Sale 2005 Sale 2006


Name Amount NAME AMMOUNT

Nafisa 9000 Nafisa 9000

Riyan 1000 Riyan 1000

Nabil 500
Nabil 500
Atasi 15000

Apshora 2500

Yields Query like this


SELECT * FROM sales 2005
Intersection NAME AMMOUNT
SELECT * FROM sales2006
Nafisa 9000

Nabil 500
Selection

Student Id Name Address

St_01 Nafisa Mirpur

St_02 Apshora Dhanmondi


Student_id Name Address
St_03 Rysa New Market St_01 Nafisa Mirpur

St_06 Mou tusi Mirpur


St_04 Fariha Moh.pur

St_06 Mou tusi Mirpur

SELECT WHERE ADDRESS=“Mirpur”


PROJECTION

Student Id Name Address Student Id Name

St_01 Nafisa Mirpur St_01 Nafisa

St_02 Apshora Dhanmondi St_02 Apshora

St_03 Rysa New Market St_03 Rysa

St_04 Fariha Moh.pur St_04 Fariha

St_06 Mou tusi Mirpur St_06 Mou tusi

PROJECT Student ID,Name


JOIN
P Q
Student Id Name
Student Id Name
St_01 90000
St_01 Nafisa
St_02 90000
St_02 Apshora

St_03 85000
St_03 Rysa

St_04 80000
St_04 Fariha

St_06 10000
St_06 Mou tusi

Yields Query Like This

STUDENT ID NAME SALARY


Select P.ID,P.NAME,Q.SALARY St_01 Nafisa 90000
From P,Q St_02 Apshora 90000
Where P.id=Q.ID
St_03 Rysa 85000
St_04 Fariha 80000
St_05 Mou tusi 10000
DIFFERENCE
P Q
Student Id Name
Student Id Name
St_02 Apshora
St_01 Nafisa

St_02 Apshora St_03 Rysa

St_03 Rysa St_07 Atasi

St_04 Fariha

St_06 Mou tusi

R
STUDENT ID NAME
St_01 Nafisa
R=P-Q St_04 Fariha
St_05 Mou tusi
Cartesian

P Q
A 1 A 10
B 2 B 20
C 3

R
A 1 A 10

A 1 B 20

B 2 A 10

B 2 B 20
R=P*Q C 3 A 10

C 3 B 20
Division
P
A B
A1 B1 Q
B
A1 B2
A2 B1 B1

A3 B1
A4 B2
A5 B1
A5 B2
R
A

A1
R=P/Q
A2

A3

A5
THANK YOU

You might also like