CST 204
CST 204
Systems
Lect 1: Introduction to Database
Data: known facts that can be recorded and that have implicit
meaning.
o Eg: Text- names, telephone nos, address,
o Image, Video, audio etc
o Flipkart, Amazon, Uber etc contains data
Database : Collection of related data
These are data but not database since they are not related data
Type of Database
Roll no – String
Name – String Roll no Name Marks
Marks - Float
eg
Roll no Name Marks
1 Akhil 34
2 Sajan 42
3 Vivek 21
Sharing a database allows multiple users and programs to access the database
simultaneously.
An application program accesses the database by sending queries or requests for
data to the DBMS.
DBMS include protecting the database and maintaining it over a long period of time
Database system contains not only the database itself but also
a complete definition or description of the database
structure and constraints.
This definition is stored in the DBMS catalog
The structure of database is stored in the DBMS catalog separately from the
access programs.
This property is called program-data independence.
Eg: in Student db
If we wish to add a new attribute DOB we can do without affecting the data
1 Akhil 34
2 Sajan 42
3 Vivek 21
E
\
This is known an program-data independence
Users can define operations on data.
Operations (also called a function or method) is specified in two
parts
The interface (or signature) of an operation includes the
operation name and the data types of its arguments.
The implementation (or method) of the operation is
specified separately and can be changed without affecting
the interface.
User application programs can operate on the data by
invoking these operations through their names and
arguments, regardless of how the operations are
implemented.
This is termed program-operation independence
The characteristic that allows program-data independence and
program-operation independence is called data abstraction
Student database
Name
Akhil
Sajan View 1: Name of the students
Vivek
--
Roll no Name Marks
2 Sajan 42
View 2: Details of the students with highest mark
Advantages of DBMS
1.Controlling Redundancy
o In traditional file processing every user maintains the copy of same
file
o But in DBMS same copy can be shared among many users, thus
redundancy can be avoided
Indexing technique
Buffered storage
4. Providing Backup and Recovery
o DBMS provide facilities for recovering from hardware or software
failures.
o backup and recovery subsystem of the
o DBMS is responsible for recovery.
o For example, if the computer system fails in the middle of a complex
update transaction, the recovery subsystem is responsible for
making sure that the database is restored to the state it was in
before the transaction started executing
5. Providing Multiple User Interfaces
• Schema definition.
o The DBA creates the original database schema by
executing a set of data definition statements in the DDL
• Storage structure and access-method definition.
o The DBA may specify some parameters pertaining to the
physical organization of the data and the indices to be
created.
• Schema and physical-organization modification
o The DBA carries out changes to the schema and physical
organization to reflect the changing needs of the
organization
• Granting of authorization for data access.
o By granting different types of authorization, DBA can
regulate which parts of the database various users can
access
• Routine Maintenance:
o Routine maintenance activities of DBA are
o Periodically backing up the database
o Ensuring that enough free disk space is available for
normal operation
o Monitoring jobs running on the database and ensuring
that performance is not degraded by expensive tasks
submitted by some users
II Database Designers
Responsible for
identifying the data to be stored in the database
choosing appropriate structures to represent and store
this data
communicate with all database users in order to
understand their requirements and to create a design
that meets these requirements
III End Users
They are the people, whose jobs are to access the database for
querying, updating, and generating reports
Categories of end users
1. Casual end users occasionally access the database,
but they may need different information each time.
They use a sophisticated database query language to
specify their requests
2. Naive or parametric end users
constantly query and update the database,
using standard types of queries and updates
The tasks that such users perform are
a. Bank tellers check account balances and post
withdrawals and deposits
b. Reservation agents for airlines, hotels, and
car rental companies check availability for a
given request and make reservations
3. Sophisticated end users
They include engineers, scientists, business analysts,
and others
They familiarize themselves with the facilities of the
DBMS in order to implement their own applications
4. Standalone users
maintain personal databases by using ready-made
program packages that provide easy-to-use menu-
based or graphics-based interfaces
An example is the user of a tax package that stores a
variety of personal financial data for tax purposes
IV System Analysts and Application Programmers (Software
Engineers)
System analysts determine the requirements of end users
and develop specifications that meet these requirements.
Application programmers implement these specifications as
programs; then they test, debug, document, and maintain
these system.
Such analysts and programmers—commonly referred to as
software developers or software engineers
Workers behind the Scene
2. Tool developers
Tools are optional packages that are often purchased
separately.
They include
o packages for database design
o performance monitoring
o natural language or graphical interfaces
o Prototyping
o Simulation, and test data generation.
In many cases, independent software vendors develop and
market these tools.
3. Operators and maintenance personnel
◦ responsible for the actual running and maintenance of the
hardware and software environment for the database
system
Structured Data
o The data is well organized either in the form of tables or some
other way
o Searching & accessing information from such data is very easy
o Eg Relational Database (data stored in tables), spreadsheets
Semi - structured data
o Semi-structured data is information that doesn’t reside in a
relational database but have some organizational
properties that make it easier to analyze.
o It is difficult to store and retrieve
o These data can be stored in a database after processing it
o For example, CSV, XML and web data such as JSON
Unstructured data
o Data which is not organized in a predefined manner
o It is not fit for relational database
o It includes text and multimedia content. For example, e-mail
messages, word processing documents, videos, photos, audio
files, presentations, web pages
DATA MODELS
Collection of concepts that can be used to describe the structure
of a database
Structure of a database we mean the data types, relationships,
and constraints that should hold on the data
Most data models also include a set of basic operations for
specifying retrievals and updates on the database
A. Hierarchical Model
B. Network model
Every data is represented as collection of records.
The database structure is like a graph.
This is similar to the hierarchical model and also provides a tree-
like structure. However, a child is allowed to have more than one
parent.
C. Relational Model
Data is organized in two-dimensional tables called relations.
The tables or relation are related to each other.
Each row represents a record, also referred to as an entity.
Each column represents a field, also referred to as an attribute.
A relational DBMS uses multiple tables to organize the data.
Relationships are used to link the various tables together.
Relationships are created using a field that uniquely identifies
each record
access paths
An access path is a structure that makes the search for
particular database records efficient
THREE-SCHEMA ARCHITECTURE
Schema, Instances and Database State
INTERNAL LEVEL
CONCEPTUAL LEVEL
It uses representational/Implementational data model
The conceptual level has a conceptual schema, which
describes the structure of the whole database for users
hides the details of physical storage structures and concentrates
on describing entities, data types, relationships, user operations,
and constraints
describes what data is stored in the database and the
relationships among
the data.
The conceptual level
represents
• All entities, their
attributes and their
relationships
• The constraints on the
data
• Semantic information
about the data
• Security and integrity
information
It uses
HighLevel/Conceptual
data Model
Describes the part of the
database that a particular
user group is interested in
and hides the rest of the
database from that user
group
DBMS must transform a request specified on an external schema
into a request against the conceptual schema, and then
into a request on the internal schema for processing over the
stored database
If the request is a database retrieval, the data extracted from the
stored database must be reformatted to match the user’s
external view.
Mappings
The processes of transforming requests and results between
levels are called mappings
These mappings may be time-consuming
DATA INDEPENDENCE
Data independence is the capacity to change the schema at one
level of a database system without having to change the
schema at the next higher level.
There are two types of data independence.
i. Logical data independence
ii. Physical data independence
1. Logical Data Independence
Database Architectures
Database Languages
ENTITY-RELATIONSHIP MODEL
CUSTOMER GOODS
Attributes
Each entity has attributes—the particular properties that describe
it.
For example, an EMPLOYEE entity may be described by the
employee’s name, age, address, salary, and job.
In E-R diagrams attributes are drawn in elliptical shapes along
with the entity rectangles
Derived attributes are represented by dotted attributes
Complex Attributes
It is a combination of composite and multi-valued attribute.
Group components of a composite attribute between parentheses
() and separating the components with commas, and by
displaying multivalued attributes between braces { }.
Eg :
Address_phone({phone_no},{Address(Flat no,city,state)})
Relationship in DBMS
Whenever an attribute of one entity type refers to another
entity type, some relationship exists.
the attribute Department of EMPLOYEE refers to the
department for which the employee works
RELATIONSHIP
Relationship is the association among several entities.
Eg2
Relationship Type
Unary relationship
Association is maintained within a single entity.
Binary relationship
Association is maintained within two entities.
Ternary Relationship
Association is maintained within three entities
1. One to one:
An entity A is associated with atmost one entity in B and an
entity in B is associated with atmost one entity in A.
Eg2