lec-1 introduction to database systems
TRANSCRIPT
-
7/28/2019 Lec-1 Introduction to Database Systems
1/55
-
7/28/2019 Lec-1 Introduction to Database Systems
2/55
Definitions:Data: facts that can be recorded and that have implicitmeaning
Database: Collection of related data
Ex. the names, telephone numbers and addresses of allthe people you know
Database Management System: A computerized record-keeping system
-
7/28/2019 Lec-1 Introduction to Database Systems
3/55
-
7/28/2019 Lec-1 Introduction to Database Systems
4/55
What is a Database?Database is shared, integrated computer structurehousing related data:
End user data (raw data)Metadata (data about data, it contains datacharacteristics and relationships
Shared collection of logically related data (and adescription of this data), designed to meet theinformation needs of an organization.
-
7/28/2019 Lec-1 Introduction to Database Systems
5/55
An Example Database
-
7/28/2019 Lec-1 Introduction to Database Systems
6/55
The Product Table
-
7/28/2019 Lec-1 Introduction to Database Systems
7/55
DatabasesLibrary cataloguesMedical recordsBank accountsStock market dataPersonnel systemsProduct catalogues
Telephone directories
Train timetables Airline bookingsCredit card detailsStudent recordsCustomer historiesStock market prices
Discussion boardsand so on
-
7/28/2019 Lec-1 Introduction to Database Systems
8/55
File TerminologyData
Raw FactsField/Attribute
Group of characters with specific meaningRecord/Tuple
Logically connected fields that describe a person,place, or thing
FileCollection of related records
-
7/28/2019 Lec-1 Introduction to Database Systems
9/55
Disadvantages of Flat File SystemsNo centralized control.Data Redundancy
Data Inconsistency Data can not be sharedStandards can not be enforced
Security issuesIntegrity can not be maintainedData dependence
-
7/28/2019 Lec-1 Introduction to Database Systems
10/55
Data Redundancy Different and conflicting versions of same dataResults of uncontrolled data redundancy
Data anomaliesModificationInsertion
DeletionData inconsistency
Lack of data integrity
Drawback of file system
-
7/28/2019 Lec-1 Introduction to Database Systems
11/55
DBMS A software system that enables users todefine, create, and maintain the database and
that provides controlled access to thisdatabase.
The examples of DBMS are MS-ACCESS,
ORACLE, SQL SERVER etc.
-
7/28/2019 Lec-1 Introduction to Database Systems
12/55
Why a DBMS?The reasons for that are, a DBMS is capable of
1. Providing data independence and efficient access of data.
2. Reducing the application development time.3. Providing Data integrity and security.4. Uniform data administration
-
7/28/2019 Lec-1 Introduction to Database Systems
13/55
-
7/28/2019 Lec-1 Introduction to Database Systems
14/55
Importance of DBMS
Makes data management more efficient and effective Query language allows quick answers to ad hoc
queries Provides better access to more and better-managed
data Promotes integrated view of organizations
operations Reduces the probability of inconsistent data
-
7/28/2019 Lec-1 Introduction to Database Systems
15/55
Why Study Databases?Databases are usefulMany computing applications deal with largeamounts of information
Database systems give a set of tools for storing,searching and managing this information
-
7/28/2019 Lec-1 Introduction to Database Systems
16/55
Why and When Do We NeedDBMS?
A large amount of data,
Concurrent access by many users,Fast access,Consistent data update,Role-based security,
Robust against hardware failures and OS crashes.
-
7/28/2019 Lec-1 Introduction to Database Systems
17/55
Advantages of DBMSCentralized control.No Data Redundancy
Data Consistency Data can be sharedStandards can be enforced
Security can be enforcedIntegrity can be maintainedData independence can be provided
Backup and Recovery
-
7/28/2019 Lec-1 Introduction to Database Systems
18/55
Advantages of DBMSData Independence : Application program should be as independentas possible from details of data representation and storage.
Efficient Data Access : DBMS uses sophisticated techniques to storeand retrieve data efficiently. E.g. hashing, indexing.
Data Integrity and Security : DBMS enforce data integrity on the data(some constraints on data) e.g. employee number cannot bealphanumeric. Security means password protection and access levels.
-
7/28/2019 Lec-1 Introduction to Database Systems
19/55
Data Administration : means organizing the database, authorizingaccess to database, managing security.
Concurrent access and crash recovery : multiple user can accessdata and DBMS protects data from system failures.
Reduced application development time : DBMS provides importantfunctions that are common to applications accessing data.
Advantages of DBMS
-
7/28/2019 Lec-1 Introduction to Database Systems
20/55
Disadvantages of DBMS High startup cost (time and effort)Relatively high maintenanceCentralization increases vulnerability.SophisticatedRecovery procedures are difficult.
-
7/28/2019 Lec-1 Introduction to Database Systems
21/55
-
7/28/2019 Lec-1 Introduction to Database Systems
22/55
Describing and storing data in DBMS
DBMS allows a user to define the data to be stored in termsof data model.Data Model : A data model describes
the structure of a database- data types, relationships, constraints,
a set of basic operations- insert, delete, modify, retrieveMost DBMS today are based on Relational Data Model .
-
7/28/2019 Lec-1 Introduction to Database Systems
23/55
Introduction to Relational Model
Terminology:
Relation: A Relation is a set of records and attributes. Alsoknown as tuples and columns.
Schema: A description of data in terms of data model is called Schema.
In relational model the schema for a relation specifies its name, the nameof each field (or attribute or column) and the type of each field.
Students ( id : numbers, name : text, age : integer, )Id Name Age
54 Ashish 2155 Akshay 25
56 Anu 21
-
7/28/2019 Lec-1 Introduction to Database Systems
24/55
We can specify the Integrity Constraints on relations : are conditionsthat the records in a relation must satisfy.
E.g. employee id should only consist of numbers.
-
7/28/2019 Lec-1 Introduction to Database Systems
25/55
-
7/28/2019 Lec-1 Introduction to Database Systems
26/55
Users may be divided into:-
those who actually use and control the content(called Actors on the Scene ) those who enable the database to be developedand the DBMS software to be designed andimplemented (called Workers Behind the
Scene ) .
Database User
-
7/28/2019 Lec-1 Introduction to Database Systems
27/55
Actors on the scene
Database administrators:
He is responsible for authorizing access to database,security, system response time.
Database User
-
7/28/2019 Lec-1 Introduction to Database Systems
28/55
1. Design of the Conceptual and physical schemas: throughinteraction with the end users.
2. Security and Authorization : creating of groups, passwords.
3. Data availability and recovery from failure
4. Database tuning : to maintain the performance by changingconceptual and physical schema.
5. Creating users: It gives some responsibilities to some users which canaccess the database & that database cant access by other user.
6.Deciding information content of database: DBA identifies
information to be recorded about the entities.
Task perform by DBA:
-
7/28/2019 Lec-1 Introduction to Database Systems
29/55
Actors on the scene
End-users: are the people whose jobs require accessto the database for querying, updating and generatingreports, the database primarily exists for their use.
System administrator : hardware system support
Database User
-
7/28/2019 Lec-1 Introduction to Database Systems
30/55
Workers on the scene
1. Database Designers:
responsible to define the content, thestructure, the constraints, and functions ortransactions against the database.
They must communicate with the end-usersand understand their needs.
design database structure
Database User
-
7/28/2019 Lec-1 Introduction to Database Systems
31/55
Workers on the scene
2. System analyst and programmers :implement application programs
3. Database systems programmerWrites the database software itself
4. Application developersWrite software to allow end users to interfacewith the database system
Database User
-
7/28/2019 Lec-1 Introduction to Database Systems
32/55
End-users End Users: are the people whose jobs require access to the database forquerying, updating and generating reports, the database primarily existsfor their use.
Categories/Types of End-users
1. Casual End Users: occasionally use database, needdifferent information each time. They are typically middleor high level managers.
2. Nave or Parametric end users: main users of database,mostly query and update the database. Use standard typesof queries and updates called canned transactions. E.g.clerks for hotels, airline, etc.
-
7/28/2019 Lec-1 Introduction to Database Systems
33/55
Categories/Types of End-users
3. Sophisticated end users:these include business analysts, scientists,engineers, others thoroughly familiar with thesystem capabilities and have good knowledge of DBMS.
4. Stand alone users:
Who maintain database for personal use andmaintain personal database by using ready madeprograms. E.g. tax package.
-
7/28/2019 Lec-1 Introduction to Database Systems
34/55
Webforms Application front
ends
SQL interface
Plan executor
Operator Evaluator Optimizer
parser Shows interaction
Query EvaluationEngine
TransactionManager
Lock manager
Files andAccessBuffer
Manager Disk space
Manager
Recovery
Manager
Index Files
DataFiles
System catalogShows references
Database
Structure of DBMS
SQL commands
-
7/28/2019 Lec-1 Introduction to Database Systems
35/55
Query Evaluation Engine : It consists of four parts.
a. Parser : A parser breaks data into smaller elements,according to a set of rules that describe its structure.
b. Query Optimizer : uses information about how the data isstored to produce an efficient execution plan for evaluatingthe query.
c. Operator Evaluator : Translates SQL query into executableform and runs it.
d. Plan Executor: Creates an plan to execute the query.
-
7/28/2019 Lec-1 Introduction to Database Systems
36/55
Files and Access Methods: In DBMS data is storedand organised into files. Each file consists of Pages andPages stores records. In records actual data is stored.
DBMS Creates different types of file like Heap file,index file, unsorted files. So this layer works with file
and there access methods.
-
7/28/2019 Lec-1 Introduction to Database Systems
37/55
Buffer Manager : It manages the pages which are brought fromdisk to main memory by Files and Access methods.
Disk Space Manager : this layer provides routines to higher layers to allocate, deallocate , read and write pages in disk.
Recovery Manager: responsible for maintaing log, and restoringthe system to a consistent state after a crash.
Transaction Manager: Deals with concurrency control andrecovery.
Lock Manager: keeps track of requests for locks and grants lock on database objects when they become available.
-
7/28/2019 Lec-1 Introduction to Database Systems
38/55
Figure The Three-schema architecture
-
7/28/2019 Lec-1 Introduction to Database Systems
39/55
DBMS Architecture1. An Internal Schema (internal level)
describes physical storage structurerelated to the physical data model
2. A Conceptual Schema (conceptual level) describes whole database structure
data types, constraints, user operations,hides the details of storage structure.Also known as Logical Schema.
-
7/28/2019 Lec-1 Introduction to Database Systems
40/55
DBMS Architecture ( cont )3. External Schemas (external level)
Each external schema describes the part of thedatabase that a particular user group isinterested . E.g. views
-
7/28/2019 Lec-1 Introduction to Database Systems
41/55
Data IndependenceThree Schema Architecture provide the capacity to change the schemaat one level of a database system without having to change the schemaat the next higher level.
Logical Data Independence : is the capacity to change the conceptualschema without having to change external schema or applicationprograms.
Physical Data Independence: is the capacity to change the internalschema without having to change the conceptual schema .
-
7/28/2019 Lec-1 Introduction to Database Systems
42/55
Introduction to Data ModelsHierarchical modelNetwork modelRelational modelObject Oriented modelObject relational model
A database model is an organizing principle that specifies particularmechanisms for data storage and retrieval.
-
7/28/2019 Lec-1 Introduction to Database Systems
43/55
Hierarchical ModelOldest data model. Information Management System (IMS) was thefirst hierarchical database developed by North american rockwell andIBM.The hierarchical model organizes data elements as tabular rows, onefor each instance of an entity.
Deputy GM 1Department 1
Employee 1Employee 2
Deputy GM 2Department 2
Employee 3
Employee 5Employee 4
General Manager
-
7/28/2019 Lec-1 Introduction to Database Systems
44/55
Advantages of Hierarchical Model
Simplicity : relationship between the various layers is logically
simple.
Data Security : It is the first model that provided security and
enforced by DBMS
Data Integrity : It is based on parent / child relationship, so there
is always a link between child and parent node.
Efficiency: it is efficient when there are many transactions using
data whose relationship is fixed.
-
7/28/2019 Lec-1 Introduction to Database Systems
45/55
Implementation of Complexity: difficulty to implement bydatabase designers and good knowledge of physical database.
Database Management Problems : change in database requires
change in application programs. Lack of structural independence: structural independenceexists when the changes to the database structure does not affectthe DBMs ability to access data. Hierarchical DBMS usesphysical storage paths to navigate to different data segments.
Programming Complexity : Application programmers mustaware of data segments access paths.
Disadvantages of HierarchicalModel
-
7/28/2019 Lec-1 Introduction to Database Systems
46/55
Network ModelNetwork model replaces Hierarchical tree with a graph thus allowing more
general connections among the nodes. For e.g. (n:n) relationships or it allows arecord to have more than one parent.
Real time example : suppose an employee works for two departments. Or inbanking an person can have two accounts.
-
7/28/2019 Lec-1 Introduction to Database Systems
47/55
Advantages of Network Model:
Conceptual Simplicity: Conceptually simple and easy to design.
Capability to handle more relationship types: Network modelcan handle one to many and many-to-many relationships.
Ease of data access : An application can access owner record andthen all member records, if any member record have more thanone owner, then application can move to other owner also.
Data Integrity: Model does not allow a member to exist withoutan owner.
Data Independence: Provide better independence thanHierarchical model. An change in data does not affect application
program.
-
7/28/2019 Lec-1 Introduction to Database Systems
48/55
Disadvantages of Network Model.
System Complexity: Network model provides navigationalaccess to the data in which the data are accessed one record at atime. Which requires DBA, database designers, application
programmers and even end users to be familiar with data access
paths.
Absence of Structural Independence: Structural change indatabase cause change in application programs becausenavigational access method exists.
-
7/28/2019 Lec-1 Introduction to Database Systems
49/55
Relational Model requires database designer to represent
real world entities into tables which is difficult.
Whereas Object Oriented model represents an entity as aCLASS. A Class represents both object attributes as well as
the behavior of the entity.
For e.g. a BOOK Class have attributes ISBN, Title, Publisheretc. but also procedure that imitate actions such as
UpdatePrice, Issue, Return.
Object Oriented Model
-
7/28/2019 Lec-1 Introduction to Database Systems
50/55
Capability to handle large no of different data types: In this model wecan store voices, animations, pictures etc.
Combination of Object-oriented programming and database
technology: Now database technology have benefits of object orientedprogramming.Improves Productivity: New features like inheritance, polymorphism,dynamic binding improves the database applications.
Advantages
-
7/28/2019 Lec-1 Introduction to Database Systems
51/55
Difficult to maintain: Major updates in databaserequires changes in class specifications.Not suited for all applications: Not suitable for smallorganizations because of high costs.
Disadvantage of Object Oriented Model :
-
7/28/2019 Lec-1 Introduction to Database Systems
52/55
It combines the advantages of modern object orientedprogramming language with relational database features.E.g. are IBM DB2 Universal Server, Oracle 8 etc.
Object Relational Model
Advantages of Object Relational Model
1. Provides advantages of Relational Model, while resolving known
weakness of the Model.
2. Reuse and Sharing: Extended Server to perform standard functionscentrally.
3. Custom data types: Developers can use custom data types.
4. Logical Independence from Data
-
7/28/2019 Lec-1 Introduction to Database Systems
53/55
Complexity: because of complex data relationship it is difficult to
model.
Increased CostStill under immature stage: some of the concepts are still developing or
unproven.
Disadvantage of Object Relational Model
-
7/28/2019 Lec-1 Introduction to Database Systems
54/55
Queries in a DBMSQuerying a DBMS means retrieving the data from the database. Forthis DBMS provides a specialized language called query language.
DBMS provides DDL and DML
DDL Data Manipulation LanguageSDL Storage Definition LanguageVDL View Definition LanguageDML Data Manipulation Language
(For data manipulations like insertion, deletion,update, retrieval, etc.)
-
7/28/2019 Lec-1 Introduction to Database Systems
55/55
DDL is used by DBA to define the Conceptual Schema.
SDL is used to specify the internal Schema.
The mapping between internal and conceptual schema can be done ineither one of these language.
VDL is used to specify the views and their mappings to the conceptual
schema.
Once the database Schemas are compiled and database is populated with data, users must have some means to manipulatethe database. Like insertion, retrieval, deletion and modificationof data.
For this the Data Manipulation Language (DML) is used.