Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 43

Introduction to Databases

Course Introduction
A Review of Database
Concepts

Introduction 1
Learning Outcomes
 Be able to understand the importance of
data, and the difference between file
management and databases.
 Be able to understand database concepts,
Database system components
 Be able to discuss, explain and apply SQL
using one commercial DBMS
 Be able to implement a database design
using one commercial DBMS
What is data?
 Data is the building block on which every
organization is built to operate.
 Data takes varied forms
 Name of a new employee, average marks
that Joe scored in her exams are examples of
data
More about Data
 Data may be manipulated and reorganized to
produce information
 For example: the marks that Joe scored will
come in handy when calculating and
displaying class wise performance
 In order to use data to extract information,
data must be stored
Manual Systems
 Data is written within books and registers.
 For example, details of faculty are maintained
in a staff register and details of students are
entered in a Student register
 Time consuming
 Consider a task of preparing mark sheets for
students manually.
Manual Systems – A thing of
the past
 Now, computers can be used for storing data,
retrieving and even manipulating data in
different combinations to obtain required
information very easily.
 Success of an organization depends on its
ability to acquire accurate, reliable and timely
data about its business or operation for
effective decision –making process.
Databases overview
 Databases are the primary form of storage in
both today's online and offline worlds.
 Databases are used to store millions of
different types/combinations of information
including product details, employees,
personal address books, news, etc.
 Before you can begin to design a database
however, you must understand the underlying
concepts and theories of why databases are
used and how they are created.
Why Databases were created
 Databases keep track of, and organize, data.
 Data is the essence of any business or organization.
 A database is sometimes referred to as a “DBMS”,
or Database Management System.
 Microsoft Access, for example, is a DBMS, along
with Microsoft SQL Server, MySQL and Oracle.
 Databases use queries.
 Queries interact with the database to extract, insert
and delete records, or otherwise work with the
database's data.
Why Databases were created
 Sort your information into any order, e.g. a phone book on
computer could be sorted by postcode, name of the town,
area code etc.
 Finding people is much easier. Unlike a paper system,
you are not reliant on one key piece of information, e.g. to
find someone in a phone book you have to know their
surname. If the phone book was on a computer, you could
know their address, their first name etc, and still use it to
find them!
 You do not have to see all the information at once. The
information that you wish to see can be extracted from the
whole, e.g. all the people who live in London, all the
people who are 3 months late in paying their bill etc.
Why Databases were created
 Information can be cross-referenced, which
would be impossible on paper, e.g. you may
want to see everyone who lives in London
and is also 3 months late with paying their
bill.
 Updates are much easier on a computer.
You can quickly delete or edit the information.
 Computers use less space than a large
paper filing system.
Evolution of databases
 Before computers, data was written in registers
 Databases existed earlier also but in the form of
files.
 Data was stored in tabular format, with the rows in
the table being called ‘records’ columns called
‘fields’
 All the data was put into one table and the term
database was used synonymously with ‘table’.
Flat-File Databases
 The table below displays a flat-file database with
some fields in it

Member Code Name Address Course

PV001 Eric Clifford 12, Kensington Psycology


Terrace
PV002 Rachel Leigh 32, West Port Medicine

PV003 Jennifer Blige 88, New Jersey Psychology

PV007 Keith Jennings 120, East Road Human Culture


Flat-File System – not very
efficient
 Searching options very tedious
 Finding a record involved looking through all the
records till the particular record was arrived at, or
no more data remained to be searched
Indexed File Oriented System
 Searching problem in flat file systems was
solved with the help of an indexed-file
oriented system.
 This system revolved around an index file,
which stored a map of records and their
locations
 Similar to index of books
 This approach speeds up the process of
searching of records
Indexed File System – not an
end to all the problems
 Some problems still persisted
 Data Redundancy
 Some data got stored unnecessarily in more than one
place

 Why is this a problem?

 Wasted space
 Potential inconsistencies (most important!)
 The process of updating information in a file filled with
repeating data eats terrible amounts of time
A file storing information
Data
Redundancy
Suppose……
 Let's say a person moves houses and has his
phone number changed.
 Instead of changing one record, three or four
must be changed.
 In a corporate environment with thousands of
records, this would take far too much time to
complete, and the system's resources would
take a major hit because of it.
Indexed File System – not an
end to all the problems
Problems Continued…
 Data Inconsistency
 This refers to maintaining the consistency of the same data in the
various files
 For example: Assume Ms. Jones changes her name to Mrs.
Jackson and the change is reflected only in some of the files
containing her data. Result – inconsistency
 Another example would be if the name and address of the
members were to be stored every time a member borrowed a
book, there could be inconsistency creeping in
 Another example would be removal of employee’s record from
‘Salary Details’ file while maintaining the employees details in
another file
 Security
 Data stored in these systems could be easily accessed by anyone,
and therefore prone to misuse
Example of Data Inconsistency
Member Code Name Address Book Code

PV001 Eric Clifford 12, Kensington AB012


Terrace

PV002 Rachel Leigh 32, West Port AB092

PV001 Eric Cliffod 17, Kensington AB221


Terrace

PV003 Jennifer Blige 88, New Jersey AB323

PV007 Keith Jennings 120, East Road AB172


More problems with File system
Data Retrieval
Problems Continued…

 No Sophisticated Tools for Selective Data


Access
Even with small db’s (e.g., calendar), want to
retrieve efficiently
1. Give me all appointments on 9/3
2. When do I next see Jim?
 Want all “retrieval programs” to:
1. Be easy-to-write
2. Execute efficiently (calendar can have 1000’s of entries)
More Problems with File System
Data Integrity
Problems Continued…

• No Support for Sharing


How to prevent simultaneous modification?
(lost updates, inconsistencies)

• No Coping Mechanisms for System Crashes


How to Recover Work?

• No Means of Preventing Data Entry Errors


Database
 Then came along the concept of database.
 It had provisions to do way with the
limitations that so far existed
 Collection of inter-related data
 Collected and stored for some purpose
 Traditionally databases ran on main frames
for business applications – true even now
 Databases now can even be used by the
average computer user
What is a Database?

 Database is a collection of data


 data is known facts with implicit meaning
 database is logically coherent, organized.
 database is designed, built and populated for a
specific purpose.
 .
Importance of Databases to Economy
 Expanding use of databases in retail sales
 Agha’s, retail sales information tracking
 Argos, catalog sales information tracking
 Examples of analyses
 Sales of items
 Comparisons between daily totals of items sold and
items in inventory
 Seasonal variations in sales of specific and similar
items
 Relative sales of similar items with different features
 Customer analysis
 Behavior of average customer
 Preferences of individual customers
Database management system

 collection of programs which support creation and


maintenance of databases
 A general purpose sw that facilitates the process
of
 Defining ( specifing data type, structure)
 Constructing ( process of storing)
 Manipulating (quering & retrieving)
 Collection of programs for defining, accessing and
modifying data files
Database Management System

 Primary goal: provide an environment which


is convenient and efficient to use.

 Provides an abstract view of the data to hide


the complexity.
Interaction between user and
Database
Components of DBMS

 DB engine:
 Heart of DB
 Responsible for storing, retrieving & updating data
 Can be purchased separetly
 E.g “Jet Engine” ------ foundation of MS Access
 Data dictionary:
 Contains deifnitions of all the data, tables
 Describe types of data stored
 Allows DBMS to keep track the data
 Helps developers & users to find the data they need
Components of DBMS
 Query Processor:
 Enables developers & users to sore and retrieve data
 When a query runs , it works with the engine to find the
appropriate data
 Report writer:
 Enables a user to setup a report to show how items will be
displayed or calculated without writing any program code
 Can be integrated into DBMS or can be a tand alone
application
 when the report is executed, the report writer passes the
query to query processor which communicates with the DB
engine to retrieve the desired row of data report writer than
formats the data & create the report
Components of DBMS
 Forms generator:
 Is used to create input forms
 Application generator:
 It is a collection of forms and reports designed for specific
user task
 Consist of tools that assist the developer in creating a
complete application package
Components of DBMS

All data
DB engine 3GL
Communication
network DB dictionary Communication
security (Provides utilities
Query processor to connect lang
with engine)
Form Report
program
builder writer

Application generator
Features and Responsibilities
of a DBMS
 Control Data Redundancy:
 Since data is spread across several tables,
repetition or redundancy of data is reduced
 Data Abstraction:
 The DBMS hides the actual way in which data is
stored, while providing the user with a conceptual
representation of data
Features and Responsibilities
of a DBMS

Conceptual Representation of data in SQL Server 2000


Features and Responsibilities
of a DBMS
 Support for Multiple Users
 DBMS allows effective sharing of data
 It ensures that several users can concurrently
access the data in the database without affecting
the speed of the data access
 In concurrent access, there is a possibility that
two users may try to modify a particular record at
the same time.
 One person’s change may be overwritten by other person’s
changes
 Solution: Record Locking
Features and Responsibilities
of a DBMS
 Multiple ways of interfacing to the System
 This would require the database to be able to be
accessible through different query languages as
well as programming languages
 It would also mean that a variety of front-end tools
should be able to use the database as a back-end
 For example: data stored in Access can be
displayed and manipulated using forms created in
software such as Visual Basic or Front Page 2000
Features and Responsibilities
of a DBMS
Item code ItemName Rate

RKSK-B Rucksacks-Brown 450

RKSK-T Rucksacks-Tan 500

Data in
the
backend
can be
displayed
in a form
Features and Responsibilities
of a DBMS
 Restricting Unauthorized Access
 DBMS provides security mechanism that ensures
that data in the database is protected from
unauthorized access and malicious use.
 The security that is implemented in most DBMS is
referred to as ‘User-level security’.
 In addition, a particular user could be restricted to
only view the data, while another could have the
rights to modify the data. A third user could
change the structure of some table
Features and Responsibilities
of a DBMS
 Enforcing Integrity Constraints
 DBMS provides a set of rules that ensure that
data entered into a table is valid
 For example, in the item table, a constraint can be
added to ensure that the ‘rate’ field only accepts
numeric type of data that must be in the range 1 -
500.
Features and Responsibilities
of a DBMS
 Backup and Recovery
 In spite of ensuring that the database is secure
from unauthorized access as well as invalid
entries, there is always a danger that the data
could get lost.
 Can happen due to system crashes or some
hardware problem
 To guard against this, the DBMS has inbuilt
backup and recovery techniques that ensure that
the database is protected from these kinds of
fatalities also.
Users of DBMS
Users of a database can be categorized into
four groups
 Database Designers:
 People who analyze the kind of data that is to be
stored in the database, and would design the
structure of the database.
 Database Administrator
 Person who monitors operations on a database
and ensures that it is maintained efficiently
Users of DBMS
 Application Developer:
 People who write programs for accessing the
database.
 End User:
 Entry of data and manipulation of this data is
taken care of by the end user.
Functions of a DBA
 Provides necessary support for implementing policy
decisions of DB.
 A central controller who oversees & manages all the
resources e.g. DB,DBMS & related sw
 Authorized access to DB carries out changes or
modification to reflect the changing needs of the
organization
 Maintains periodical back-up of the DB to prevent
data loss
 Responsible for repairing damage to DB
Microsoft Access 2007
 For the lab sessions we will be working on
Access 2007, a DBMS.

You might also like