Database Overview
Ashis Talukder, PhD
Associate Professor,
Management Information Systems (MIS)
University Of Dhaka
Ashis Talukder, PhD, MIS, DU
Introduction
Traditional File Management
DBM
Purpose of Database Systems
Data Models
Data Definition Language
Data Manipulation Language
Database Administrator
Database Users
Overall System Structure
Ashis Talukder, MIS, DU
Database
A database is an organized collection of
structured information, or data, typically stored
electronically in a computer system.
Databases can be thought of as an organized
collection of information.
Databases are used for
storing,
maintaining and
accessing any sort of data.
Ashis Talukder, MIS, DU
Database
Databases collect information on people,
places or things.
That information is gathered in one place
so that it can be observed and analyzed.
Data may be logically organized into
characters, fields, records, files & databases.
Ashis Talukder, MIS, DU
A Sample Database: Banking Database
Branch table
LOAN table Borrower table
Ashis Talukder, MIS, DU
Database Organization
Bit:
− Smallest unit of data
− binary digit (0/1, On/Off or Y/ N)
− Most basic unit of physical storage
Byte:
− Group of bits that represents a single
alphabetic, numeric or other symbols
− Also called character
Ashis Talukder, MIS, DU
Database Organization
Field:
− Next higher level of data
− Consists of group of bytes or a complete
number which represent DETUM or FACT
− Example: Name, account number, roll,
balance
Record:
− Group of interrelated fields
− Example: (11, Mina, 82) (roll, name, marks)
Ashis Talukder, MIS, DU
Database Organization
File/Table:
− Group of records of same type
− Example: customer table, account table
Database:
− Integrated all tables/files of an enterprise
− Example: customer table, account table
Ashis Talukder, MIS, DU
Database Organization: The Data Hierarchy
Ashis Talukder, MIS, DU
Database Management System (DBMS)
Collection of interrelated data
Set of programs to access the data
DBMS contains information about a particular enterprise
Goal of the DBMS is to provides a way to store and retrieve
database information that is both convenient and efficient.
Database Applications:
Banking: Customer Information, loans, and all transactions
Airlines: reservations, schedules
Universities: registration, grades
Sales: customers, products, purchases
Manufacturing: production, inventory, orders, supply chain
Human resources: employee records, salaries, tax deductions
Databases touch all aspects of our lives
Ashis Talukder, MIS, DU
Purpose of Database System
In the early days, database applications were built on top of file
systems
Drawbacks of using file systems to store data:
Data redundancy and inconsistency
Multiple file formats, duplication of information in different files
Difficulty in accessing data
Need to write a new program to carry out each new task
Data isolation
multiple files and formats
Integrity problems
Integrity constraints (e.g. account balance > 0) become part of
program code
Hard to add new constraints or change existing ones
Ashis Talukder, MIS, DU
Purpose of Database Systems (Cont.)
Drawbacks of using file systems (cont.)
Atomicity of updates
Failures may leave database in an inconsistent state with partial
updates carried out
E.g. transfer of funds from one account to another should either
complete or not happen at all
Concurrent access by multiple users
Concurrent accessed needed for performance
Uncontrolled concurrent accesses can lead to inconsistencies
E.g. two people reading a balance and updating it at the same time
Security problems
Database systems offer solutions to all the above problems
Ashis Talukder, MIS, DU
Some Commercial Database Management Systems
Microsoft Access
FoxPro
dBase
Oracle – Oracle 8i, Oracle9i, Oracle 10g
Microsoft SQL Server
IBM DB2/DB2UDB
Informix
Sybase
MySQL
Ingress
Postgre SQL
Ashis Talukder, MIS, DU
Data Models
Models
A collection of tools for describing
data
data relationships
data semantics
data constraints
Model Examples
Entity-Relationship model
Relational model
object-oriented model
semi-structured data models
network model and
hierarchical model
Ashis Talukder, MIS, DU
Relational Database Model
represents the database as a collection of
relations.
A relation is nothing but a table of values.
Every row in the table represents a collection of
related data values. These rows in the table
denote a real-world entity or relationship.
The table name and column names are helpful to
interpret the meaning of values in each row.
Ashis Talukder, MIS, DU
Relational Database Model
Attributes
customer- customer- customer- account-
Customer-id
name street city number
192-83-7465 Johnson
Alma Palo Alto A-101
019-28-3746 Smith
North Rye A-215
192-83-7465 Johnson
Alma Palo Alto A-201
321-12-3123 Jones
Main Harrison A-217
019-28-3746 Smith
North Rye A-201
Ashis Talukder, MIS, DU
A Sample Relational Database:
Banking Database
branch table
loan table borrower table
Ashis Talukder, MIS, DU
Relational Database Models
The data are represented as a set of
relations.
In the relational model, data are stored as
tables.
However, the physical storage of the data is
independent of the way the data are
logically organized.
Ashis Talukder, MIS, DU
Relational Database Models
Attribute: Each column in a Table. Attributes are the properties
which define a relation. e.g., Student_Rollno, NAME,etc.
Tables: In the Relational model the, relations are saved in the
table format. It is stored along with its entities. A table has two
properties rows and columns. Rows represent records and
columns represent attributes.
Tuple: It is nothing but a single row of a table, which contains a
single record.
Relation Schema: A relation schema represents the name of the
relation with its attributes.
Degree: The total number of attributes which in the relation is
called the degree of the relation.
Ashis Talukder, MIS, DU
Relational Database Models
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a
specific attribute.
Relation instance: Relation instance is a finite set of
tuples in the RDBMS system. Relation instances never
have duplicate tuples.
Relation key: Every row has one, two or multiple
attributes, which is called relation key.
Attribute domain: Every attribute has some pre-defined
value and scope which is known as attribute domain
Ashis Talukder, MIS, DU
Relational Database Model
Attributes
customer- customer- customer- account-
Customer-id
name street city number
192-83-7465 Johnson
Alma Palo Alto A-101
019-28-3746 Smith
North Rye A-215
192-83-7465 Johnson
Alma Palo Alto A-201
321-12-3123 Jones
Main Harrison A-217
019-28-3746 Smith
North Rye A-201
Ashis Talukder, MIS, DU
A Sample Relational Database:
Banking Database
branch table
loan table borrower table
Ashis Talukder, MIS, DU
Advantages of RDBMS
Simplicity: A Relational data model in DBMS is simpler than the
hierarchical and network model.
Structural Independence: The relational database is only concerned with
data and not with a structure. This can improve the performance of the
model.
Easy to use: The Relational model in DBMS is easy as tables consisting of
rows and columns are quite natural and simple to understand
Query capability: It makes possible for a high-level query language like
SQL to avoid complex database navigation.
Data independence: The Structure of Relational database can be changed
without having to change any application.
Scalable: Regarding a number of records, or rows, and the number of
fields, a database should be enlarged to enhance its usability.
Ashis Talukder, MIS, DU
Dis-Advantages of RDBMS
Few relational databases have limits on field
lengths which can't be exceeded.
Relational databases can sometimes become
complex as the amount of data grows, and the
relations between pieces of data become more
complicated.
Complex relational database systems may lead
to isolated databases where the information
cannot be shared from one system to another.
Ashis Talukder, MIS, DU
Primary key & Foreign key
Primary key: One ore more fields that can identify a record from a table.
Student ID in the STUDENTS table
Class ID in the CLASSES table
Foreign Key: If a primary key (field/fields) of one table is present in
another table, then, it is called the foreign key in 2nd table.
Student ID in the ELROLLMENTS table
Class ID in the ELROLLMENTS table
Ashis Talukder, MIS, DU
A Sample Relational Database
Foreign
Primary
Key
Key
Ashis Talukder, MIS, DU
Database Language
A database system provides
a data-definition language to specify the
database schema and
a data-manipulation language to express
database queries and update.
Ashis Talukder, MIS, DU
Data Definition Language (DDL)
Specification notation for defining the database schema
E.g.
create table account (
account-number char(10),
balance integer)
DDL is also used to specify additional properties of the data.
Example : Alter/DROP/TRUNCATE/ comment/ Grant/ Revoke
The storage structure and access methods used by the database system by a set
of statements in a special type of DDL called a data storage and definition
language
DDL compiler generates a set of tables stored in a data dictionary
Data dictionary contains metadata (i.e., data about data)
Database schema
Data storage and definition language
language in which the storage structure and access methods used by
the database system are specified
Usually an extension of the data definition language
Ashis Talukder, MIS, DU
DDL (Cont.)
The data values stored in the database must satisfy certain
consistency constraints.
Domain Constraints : A domain of possible values must be associated with
every attribute ( i.e. Char type, integer type, date/time etc)
Referential Integrity : There are cases where we wish to ensure that a
value that appear in one relation for a given set of attribute also appears for
a certain set of attributes in another relation.
Assertions: An assertion is any condition that the database must always
satisfy, i.e. Account Balance >=$100.
Authorization : differentiate among the user as far as the type of access
they are permitted on various data values in the database.
Read authorization
Insert authorization
Update authorization
Delete authorization.
Ashis Talukder, MIS, DU
Data Manipulation Language (DML)
Language for accessing and manipulating the
data organized by the appropriate data model
DML also known as query language
Two classes of languages
Procedural – user specifies what data is required and
how to get those data
Nonprocedural – user specifies what data is required
without specifying how to get those data
SQL is the most widely used query language
Ashis Talukder, MIS, DU
SQL
SQL: widely used non-procedural language
E.g. find the name of the customer with customer-id 192-83-7465
select customer.customer-name
from customer
where customer.customer-id = ‘192-83-7465’
E.g. find the balances of all accounts held by the customer with customer-id
192-83-7465
select account.balance
from depositor, account
where depositor.customer-id = ‘192-83-7465’ and
depositor.account-number = account.account-number
Application programs generally access databases through one of
Language extensions to allow embedded SQL
Application program interface (e.g. ODBC/JDBC) which allow SQL queries to
be sent to a database
Ashis Talukder, MIS, DU
Database users
Users are differentiated by the way they expect to
interact with the system. Four different types:
Naive users: are unsophisticated users who interact
with the system by invoking one of the permanent
application programs that have been written
previously.
E.g. people accessing database over the web, bank tellers,
clerical staff
Application programmers: are computer professionals
who write application programs. Application
programmers can choose from many tools to develop
user interface.
Ashis Talukder, MIS, DU
Database users
Sophisticated users: interact with the system without writing
programs. Instead, they form their requests in a database
query language. Analysts who submits queries to explore
data in the database.
e.g., analyst looking at sales data (OLAP – Online analytical
processing), data mining – finds certain kinds of patterns in data.
Specialized users: are sophisticated users who write
specialized database applications that do not fit into the
traditional data processing framework.
e.g., computer-aided design systems, knowledge-base
and expert systems and environment-modeling
systems – uses complex data types.
Ashis Talukder, MIS, DU
Database Administrator (DBA)
Coordinates all the activities of the database system; the database
administrator has a good understanding of the enterprise’s
information resources and needs. DBA has central control of both
data and the programs that access that data.
Database administrator's duties include:
Schema definition
Storage structure and access method definition
Schema and physical organization modification
Granting user authority to access the database
Specifying integrity constraints
Acting as liaison with users
Monitoring performance and responding to changes in
requirements
Ashis Talukder, MIS, DU