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

1st Week Database-Systems

Uploaded by

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

1st Week Database-Systems

Uploaded by

rubasaleeee
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 59

DATABASE-SYSTEMS

Lecture - 1
By
Ms. Tanvir Fatima
I NSTRUCTOR

 Email: [email protected]

 GCR:

2
Database Systems

What we are going to learn in this subject?

The basic concepts of databases, why we need them,


how it can be subdivided, why it is important, what we
can achieve by this course?
COURSE
FLOW
Database Introduction to
Environment Databases

Relational
The Relational
Algebra and
Model
Calculus

S Q L Data S Q L Data
Manipulation
Definition
Database
Planning and E R Modeling
Design
4
C O N T…

E E R Modeling Normalization

Logical Conceptual
D atabase Database
Design Design

Transaction Query
Management Optimization
What is Database
What comes in our mind?

Air - Base Data - Base


What is database
But actually it is?
Why do we need databases?

• Why can’t we just use the file system?


• Store data in files
Using the File System

• Sometimes using the file system for


your applications is just fine
• Word processing
• Pictures
• Games
• As the complexity of the application and the
amount of information it works with increase, some
disadvantages of exclusively relying on the file
system start to surface..
• Example – consider a banking system
FILE PROCESSING
SYSTEMS
Collection of application programs that performs
services for the end-users (e.g. Reports)
 Each program defines and maintains its own
data

10
FILE PROCESSING SYSTEMS

11
LIMITATIONS OF FILE-BASED
APPROACH
⚫ Separati on and isolation of data
⚫ Each program maintains its own set of data. Users
• of one program may be unaware of potentially useful data held by other
programs.
⚫ Duplicati on of data
⚫ Same data is held by different programs. Wasted
• space and potentially different values and/or different formats for the same
item.

⚫ Atomicity of updates
⚫ Failure may lead database to an inconsistent state
• with partial updates carried out
⚫ E.g. Transfer of funds from one account to another should either be complete
20
or incomplete, no in- between state
LIMITATIONS OF FILE-BASED APPROACH
 Data dependence
⚫ File structure is defined in the program code.

 Incompatible file formats


⚫ Programs are written in different languages, and
so cannot easily access each others files.

 Integrity Problems
⚫ Hard to add new constraint or update existing one

21
LIMITATIONS OF FILE-BASED
APPROACH
Fixed Queries/Proliferation of application

programs
⚫ Programs are written to satisfy particular
functions. Any new requirement needs a new
program.

 Data Redundancy and Inconsistency


⚫ Multiple file formats, and duplication of
information in different files

 Difficulty in Accessing Data


⚫ Need to write a new program for accessing
22
new data
Why Use a Database
Instead of the File System?
File System Disadvantages
• Integrity constraints buried in
application logic – hard to add to
• Data redundancy - wasted space or change
• Update issues – every copy of
the data needs to be modified • Atomicity problems – what
happens when the system
• Data inconsistency – sometimes crashes during an important
every copy is not modified
operation?
• Data access issues (getting to just • Concurrency issues – when
the right data)
• “There’s no program for that.” multiple users work with the
same data at the same time
• Data isolation - pulling all the
data from disparate sources • Security issues – how to give
together) someone access to some, but not
all, of the data
Why do we need databases?
1. Data storage and retrieval:.
2. Data consistency and integrity:
3. Performance optimization:
4. Data scalability and concurrency
Difference b/w database system and file system
File System Database Management System

File system is a software that manages and organizes


DBMS is a software for managing the database.
the files in a storage medium within a computer.

Redundant data can be present in a file system. In DBMS there is no redundant data.

It doesn’t provide backup and recovery of data if it is It provides backup and recovery of data even if it is
lost. lost.

There is no efficient query processing in file system. Efficient query processing is there in DBMS.

There is more data consistency because of the


There is less data consistency in file system.
process of normalization.

It has more complexity in handling as compared to


It is less complex as compared to DBMS.
file system.

File systems provide less security in comparison to DBMS has more security mechanisms as compared
DBMS. to file system.

It is less expensive than DBMS. It has a comparatively higher cost than a file system.
What is “database” & “database systems”?
What is “database” & “database systems”

“A DATABASE is an organized collection of structured information,


or data, typically stored electronically in a computer system.”

“A database is usually controlled by a DATABASE


MANAGEMENT SYSTEM (DBMS). Together, the data and the
DBMS, along with the applications that are associated with them,
are referred to as a database system, often shortened to just
database.”
What is “database” & “database systems”
• Database involves many thing but some of them following:

• Store structure of Data

• Types of data

• Modeling of Data

• Management of Data

• etc
Difference b/w database and data structure

V/S
Difference b/w database and data structure
Database Data Structure
It is a special format for storing data to serve a
It is an organized collection of data.
particular purpose.
It is used for efficiency and to reduce the complexities
It is used to access the data and manage it easily.
of the program.

Structured query language (SQL) is used to perform


operations on the data in a database. Programming languages like C, C++, Java, Python
Database Management System (DBMS) is used to are used to perform operations using data Structures.
manage the database.

It is a Non-volatile memory. It is a volatile memory.


Types: Relational database, NOSQL database,
Types: Linear data structure and non-linear data
Centralized database, Hierarchical database are
structure are the types of data structures.
some types of databases.
Example: MySQL, SQL Server, Oracle, MongoDB, Example: Array, Linked List, Stack, Queue, Tree,
SQLite and etc. Graph.
Data Vs Information & its types?
Data Vs Information & its types
• Data: A collection of raw facts and figures is known as data.
• Types of Data
• Numeric Data
• Alphabetic Data
• Alphanumeric Data
• Image Data
• Audio Data
• Video Data
Information: The processed data is known as information. A useful or meaningful
data is also known as information.
DATA VS .
INFORMATION
Data: Raw facts/Un-processed information
⚫ But they are building blocks for information

 Information: Data Processed to reveal its


meaning
⚫ Information is meaningful
⚫ In today’s world, accurate, relevant and
timely information is the key to good decision
making
⚫ Good decision making is key to survival in
today’s
competitive and global environment
26
T HE
N EED

27
Concepts of Tables in Database

Table is the fundamental object of the database structure. The basic purpose of a table is to
store data. A table consists of rows and columns.

Row/Record/tuple: Rows are the horizontal part of the table. A single row is known as record or
tuple. Table in this slide has 3 records.

Column/field/attribute: Columns are the vertical part of the table. A single column is known as field
or attribute. Above table has 4 fields or attributes.
Relation: In relation model, data is stored in the form of relations. Relation is another name used for
table.
Concepts of Users in Database

End users (EU) Database Administrator (DBA)


Use the database system to Designs & manages the
achieve some goal database system/Provide
technical support
Application developers (AD)
Write software to allow end Database systems programmer
users to interface with the Writes the database software
database system itself
Database Management System

DBMS is a system software for creating and managing databases.


A software that interacts with end users, applications, and the database
itself to store and analyze the data
DBMS provides:
efficient, reliable, convenient and safe (don’t loss or override or corrupt)
multi-user (concurrency control) storage of and access to massive
amount of persistent data.
Database Management System
• A set of programs which manages and control database is known as Database Management
System.
• List of functions of DBMS?
Database Management System
• A set of programs which manages and control database is known as Database Management
System.
• List of functions of DBMS:
• Create database
• Create tables
• Create structures
• Read database data
• Update database data
• Maintain database structures
• Enforce rules
• Perform Security
• Perform Backup and Recovery
Database Management System in a gaming Point
of view
• A database management system (DBMS) can have several functions in a gaming point of view. Here are some common
functions of a DBMS in the context of gaming.
Database Management System in a gaming Point
of view
A database management system (DBMS) can have several functions in a gaming point of view. Here are some common functions
of a DBMS in the context of gaming.

• Player and Account Management


• Game Progress and Save Data
• Leaderboards and Rankings
• In-Game Economy and Virtual Goods
• Matchmaking and Multiplayer
• Game Analytics and Telemetry
• Content Management
• Anti-Cheating and Security
Examples of Database Management System

• Web indexes • Train timetables


• Library catalogues • Airline bookings
• Medical records • Credit card details
• Bank accounts • Student records
• Stock control • Customer histories
• Personnel systems • Stock market prices
• Product catalogues • Discussion boards
• Telephone directories • and so on…
What Database Management System Do

• Provides users with


• Data definition language (DDL)
• Data manipulation language (DML)
• Data control language (DCL)
• Transaction Control Language (TCL)
• Often these are all the same language
What Database Management System Do
Data Definition Language
• These SQL commands are mainly categorized into four categories as discussed below:
• DDL(Data Definition Language) : DDL or Data Definition Language actually consists of the SQL
commands that can be used to define the database schema. It simply deals with descriptions of
the database schema and is used to create and modify the structure of database objects in
database. Examples of DDL commands:
• CREATE – is used to create the database or its objects
• DROP – is used to delete objects from the database.
• ALTER-is used to alter the structure of the database.
• TRUNCATE–is used to remove all records from a table, including all spaces allocated for the records are removed.
• COMMENT –is used to add comments to the data dictionary.
• RENAME –is used to rename an object existing in the database.
Data Manipulation Language
• DML(Data Manipulation Language) : The SQL commands that deals with the manipulation of data
present in database belong to DML or Data Manipulation Language and this includes most of the
SQL statements. Examples of DML:
• SELECT – is used to retrieve data from the a database.
• INSERT – is used to insert data into a table.
• UPDATE – is used to update existing data within a table.
• DELETE – is used to delete records from a database table.
DCL and TCL
• DCL(Data Control Language) : DCL includes commands such as GRANT and
REVOKE which mainly deals with the rights, permissions and other controls of the
database system. Examples of DCL commands:
• GRANT-gives user’s access privileges to database.
• REVOKE-withdraw user’s access privileges given by using the GRANT command.
• TCL(Transaction Control Language) : TCL commands deals with the transaction
within the database. Examples of TCL commands:
• COMMIT– commits a Transaction.
• ROLLBACK– rollbacks a transaction in case of any error occurs.
What DBMS Does
• DBMS provides
• Persistence
• Concurrency (Multi tasking)
• Integrity
• Security
• Data independence
• Data Dictionary
• Describes the database itself
Data Dictionary - Metadata
• The dictionary or catalogue stores information about the database itself
• This is data about data or ‘metadata’
• Almost every aspect of the DBMS uses the dictionary
• The dictionary holds
• Descriptions of database objects (tables, users, rules, views, indexes,…)
• Information about who is using which data (locks)
• Schemas and mappings
Database Environment
Database Environment
Backend / Developer Side

Front End / User Side


Phases of Database Design
• Requirement Collection and Analysis
• Functional Requirements
• Conceptual Database Design
• Logical Database Design
• Physical Database Design
Phases of Database Design
Client
1
Requirement DBMS-independent
Collection and Analysis 2
3 Functional
Conceptual Database Requirements
Design
4
Logical Database
Design
DBMS-dependent
5
Physical Database
Design
Requirement Collection and Analysis

Client
1 Database designers interview clients to
Requirement Collection and understand and document their
Analysis requirements
Functional Requirements

Client
1
Requirement Collection and
Analysis
2
Functional
Requirements
What kind of queries will be applied to the database?
transactional queries or analytical queries?
Conceptual Schema

Client
1
Requirement Collection
and Analysis
3
Conceptual
Database Design
Models all of the information gathered in phase1
Includes detailed descriptions of entities and
relationships
Figure: Conceptual Schema
Conceptual Schema= {entities, attributes, relationships}
Logical Database Schema

Client
1 Constraint
Requirement Collection and Enforces limit to the data that can be
Analysis inserted/updated/deleted from a table (e.g. attribute X
3 cannot have duplicate values; attribute Y cannot have
Conceptual
null values)
Database Design
4 Logical Schema = {entities, attributes, constraints, data
Logical types, relationships}
Database Design

Describes what data will be stored (e.g. what tables are used, what
data types are used, what constraints are applied)
Logical Schema
Physical Database Schema
Client
1
Requirement Collection and
Analysis 2
3 Functional
Conceptual Requirements
Database Design
4
Logical SQL code used to build database describes how data
Database Design will be stored (i.e. define index structures and storage
5 layout)
Physical
Database Design
Physical Database Schema

Figure: Internal Schema


Internal Schema = {entities, attributes, relationships, data types, constraints, indexes}
Database design for gaming
1. Requirement Collection and Analysis:
For example, requirements may include capturing player information (username, level, achievements), game progress,
inventory management, and leaderboard data.

2. Functional Requirements:
Specific to the gaming application. For instance, the database should support player registration, login, character creation, game
session management, saving and loading game progress, and handling multiplayer interactions.

3. Conceptual Database Design:


High-level structure and relationships of the database. Examples of conceptual design elements could be entities like Players,
Characters, Levels, Achievements, Items, and Relationships such as Player-Character, Character-Item, and Player-Game.

4. Logical Database Design:


Conceptual design into a database model. In gaming, the logical design may involve creating tables like Player (with attributes
such as ID, username, password), Character (with attributes like character ID, name, level), and Game (with attributes like game
ID, title, description).

5. Physical Database Design:


For gaming, the physical design may involve selecting a DBMS (e.g., MySQL, PostgreSQL, MongoDB) and implementing the
tables, columns, indexes, and constraints based on the chosen DBMS.
Levels of Abstraction
To ease the user interaction with database, the developers hide internal
irrelevant details from users. This process of hiding irrelevant details from user
is called data abstraction.

• There three types of level


• External level/View level
• Logical level/Conceptual level
• Physical level/Internal level
View Level/ External Level

Highest level of data abstraction. This describes the user interaction with
database system.

At external/view level, user just interact with system with the help of GUI
and enter the details at the screen, they are not aware of how the data is
stored and what data is stored; such details are hidden from them.
Logical / Conceptual Level

Logical level: This is the middle level of 3-level data abstraction architecture.
It describes what data is stored in database.

It describes what will be the entities, what will be their attributes and
relationships between them.
Physical / Internal Level

This is the lowest level of data abstraction. It describes how data is actually
stored in database and what type of data will be stored.

Let’s say we are storing customer information in a customer table.


At physical level these records can be described as blocks of storage (bytes,
gigabytes, terabytes etc.) in memory.
Ms.Tanvir Fatima 59

You might also like