Upload
aliza-herd
View
218
Download
0
Tags:
Embed Size (px)
Citation preview
Introduction to DatabaseIntroduction to Database
How to Organize Information?How to Organize Information?
What are the different structures we use to What are the different structures we use to organize information?organize information?
What are the organizing principles?What are the organizing principles?
Organizational MemoryOrganizational Memory
Provides support for Provides support for Transaction processingTransaction processing Decision makingDecision making
services
Organizationalmemory
DataQuality
decisions
Qualityproducts
Quality
Daily Interaction with DatabasesDaily Interaction with Databases
Trip to a bankTrip to a bank Processes conducted?Processes conducted?
• Withdraw, deposit, etc …Withdraw, deposit, etc … Stored data?Stored data?
• Customers, accounts , balances, employees, etc …Customers, accounts , balances, employees, etc …
Airline/Hotel reservation?Airline/Hotel reservation? Customer, airlines, airports, flights, times, captains, payment Customer, airlines, airports, flights, times, captains, payment
informationinformation
Book purchase from Amazon.com?Book purchase from Amazon.com? Book inventory, customer, credit card, credit card company, Book inventory, customer, credit card, credit card company,
Amazon’s balance, your balance, etc …Amazon’s balance, your balance, etc …
Data, Information, and Data, Information, and KnowledgeKnowledge
DataData Raw, unsummarized, and unanalyzed factsRaw, unsummarized, and unanalyzed facts
InformationInformation Data processed into a meaningful formData processed into a meaningful form One person's information can be another's dataOne person's information can be another's data
KnowledgeKnowledge Knowing what information is requiredKnowing what information is required Knowing what the information meansKnowing what the information means
Data
InformationConversion
Decision
Knowledge
InterpretationRequest
What is a Database?What is a Database? A database is a collection of related A database is a collection of related
datadata Implicit properties:Implicit properties:
A database represents some aspect of A database represents some aspect of real-world (miniworld)real-world (miniworld)
A database is designed for some specific A database is designed for some specific applicationapplication
It has an intended group of usersIt has an intended group of users
What is a DBMS? What is a DBMS?
A database is a mechanized, shared, formally A database is a mechanized, shared, formally defined and centrally controlled collection of defined and centrally controlled collection of data.data.
Implications:Implications: Multiple Independent UsersMultiple Independent Users Concurrent AccessConcurrent Access Central RepositoryCentral Repository InformationInformation
Typical DBMS FunctionalityTypical DBMS Functionality
Define a database in terms of data types, structures and constraints
Construct or load (with data) the database on a secondary storage medium
Manipulating the database: querying, generating reports, insertions, deletions and modifications to its content
Concurrent processing and sharing by a set of users and programs
yet, keeping all data valid and consistent! Other features (useful but not mandatory):
Protection (against malfunction) or security measures to prevent unauthorized/malicious access
Database UsersDatabase Users
End-users: interact with the database End-users: interact with the database applicationsapplications
Application programmersApplication programmers Database administrator (DBA)Database administrator (DBA)
Deciding information content of databaseDeciding information content of database Deciding storage structure and access strategyDeciding storage structure and access strategy Interact with usersInteract with users Defining security and integrity checksDefining security and integrity checks Backup and recovery strategyBackup and recovery strategy Monitoring performanceMonitoring performance
Files and DatabasesFiles and Databases
File: A collection of records or documents File: A collection of records or documents dealing with one organization, person, area or dealing with one organization, person, area or subject. (Rowley)subject. (Rowley) Manual (paper) filesManual (paper) files Computer filesComputer files
Database: A collection of similar records with Database: A collection of similar records with relationships between the records. (Rowley)relationships between the records. (Rowley) bibliographic, statistical, business data, images, etc.bibliographic, statistical, business data, images, etc.
Traditional File Processing vs. Traditional File Processing vs. DatabaseDatabase
Sales Order program Payroll program
EmployeeCustomerInventorySalesman
Invoicing program
Customer
Traditional File processing approach
EmployeeCustomerInventory
DBMS
Other data
Database as a collection of related files
Sales Order program Payroll program Invoicing program
File Based SystemsFile Based Systems
Naughty
NiceJust what asked for
CoalEstimation
DeliveryList
Application File
ToysAddresses
Toys
Traditional File-Based SystemsTraditional File-Based Systems
A collection of application programs that perform A collection of application programs that perform services for the end-users such as the production of services for the end-users such as the production of reports. Each program defines and manages its own reports. Each program defines and manages its own data.data.
Limitations of the File-Based Approach:Limitations of the File-Based Approach: Separation and isolation of dataSeparation and isolation of data Duplication of dataDuplication of data Data dependenceData dependence Incompatible file formatIncompatible file format Fixed queriesFixed queries
Disadvantages of File ProcessingDisadvantages of File Processing
Program-Data DependenceProgram-Data Dependence All programs maintain metadata for each file they useAll programs maintain metadata for each file they use
Duplication of DataDuplication of Data Different systems/programs have separate copies of the same dataDifferent systems/programs have separate copies of the same data
Limited Data SharingLimited Data Sharing No centralized control of dataNo centralized control of data
Lengthy Development TimesLengthy Development Times Programmers must design their own file formatsProgrammers must design their own file formats
Excessive Program MaintenanceExcessive Program Maintenance 80% of of information systems budget80% of of information systems budget
Problems with Data DependencyProblems with Data Dependency Each application programmer must maintain their
own data Each application program needs to include code
for the metadata of each file Each application program must have its own
processing routines for reading, inserting, updating and deleting data
Lack of coordination and central control Non-standard file formats
Figure 1-2 Three file processing systems at Pine Valley Furniture
Duplicate Data
Problems with Data Problems with Data RedundancyRedundancy
Waste of space to have duplicate dataWaste of space to have duplicate data Causes more maintenance headachesCauses more maintenance headaches The biggest problem: The biggest problem:
When data changes in one file, could When data changes in one file, could cause inconsistenciescause inconsistencies
Compromises Compromises data integritydata integrity
SOLUTION: SOLUTION: The DATABASE ApproachThe DATABASE Approach
Central repository of shared dataCentral repository of shared data Data is managed by a controlling Data is managed by a controlling
agentagent Stored in a standardized, convenient Stored in a standardized, convenient
formform
Requires a Database Management System (DBMS)
Database Management Database Management SystemSystem
DBMS manages data resources like an operating system manages hardware resources
A software system that is used to create, maintain, and provide controlled access to user databases
DBMS BenefitsDBMS Benefits Minimal Data RedundancyMinimal Data Redundancy Consistency of DataConsistency of Data Integration of DataIntegration of Data Sharing of DataSharing of Data Ease of Application DevelopmentEase of Application Development Uniform Security, Privacy, and Integrity Uniform Security, Privacy, and Integrity
ControlsControls Data Accessibility and ResponsivenessData Accessibility and Responsiveness Data IndependenceData Independence Reduced Program MaintenanceReduced Program Maintenance
DisadvantagesDisadvantages
ComplexityComplexity SizeSize Cost of DBMSCost of DBMS Additional hardware costsAdditional hardware costs Cost of conversionCost of conversion PerformancePerformance Higher impact on failureHigher impact on failure
Terms and ConceptsTerms and Concepts
Data IndependenceData Independence Physical representation and location of data Physical representation and location of data
and the use of that data are separatedand the use of that data are separated• The application doesn’t need to know how or The application doesn’t need to know how or
where the database has stored the data, but just where the database has stored the data, but just how to ask for it.how to ask for it.
• Moving a database from one DBMS to another Moving a database from one DBMS to another should not have a material effect on application should not have a material effect on application programprogram
• Recoding, adding fields, etc. in the database Recoding, adding fields, etc. in the database should not affect applicationsshould not affect applications
Types of Database SystemsTypes of Database Systems
PC DatabasesPC Databases Centralized DatabaseCentralized Database Client/Server DatabasesClient/Server Databases Distributed DatabasesDistributed Databases Database ModelsDatabase Models
PC DatabasesPC Databases
E.G.AccessFoxProDbaseEtc.
Centralized DatabasesCentralized Databases
Central Computer
Client Server DatabasesClient Server Databases
NetworkClient
Client
Client
DatabaseServer
Distributed DatabasesDistributed Databases
computercomputer
computer
Location A
Location CLocation B
HomogeneousDatabases
Distributed DatabasesDistributed Databases
Local Network
DatabaseServer
Client
Client
CommServer
Remote Comp.
Remote Comp.
HeterogeneousOr FederatedDatabases
Range of Database ApplicationsRange of Database Applications
PC databasesPC databases Usually for individual Usually for individual
Workgroup databasesWorkgroup databases Small group use where everyone has access to the Small group use where everyone has access to the
database over a LANdatabase over a LAN Departmental databasesDepartmental databases
Larger than a workgroup – but similarLarger than a workgroup – but similar Enterprises databasesEnterprises databases
For the entire organization over an intranet (or For the entire organization over an intranet (or sometimes the internet)sometimes the internet)
Terms and ConceptsTerms and Concepts
Database activities:Database activities: CreateCreate
• Add new data to the databaseAdd new data to the database ReadRead
• Read current data from the databaseRead current data from the database UpdateUpdate
• Update or modify current database dataUpdate or modify current database data DeleteDelete
• Remove current data from the databaseRemove current data from the database
Terms and ConceptsTerms and Concepts
EnterpriseEnterprise OrganizationOrganization
EntityEntity Person, Place, Thing, Event, Concept...Person, Place, Thing, Event, Concept...
AttributesAttributes Data elements (facts) about some entityData elements (facts) about some entity Also sometimes called fields or items or domainsAlso sometimes called fields or items or domains
Data valuesData values instances of a particular attribute for a particular entityinstances of a particular attribute for a particular entity
Terms and ConceptsTerms and Concepts
RecordsRecords The set of values for all attributes of a The set of values for all attributes of a
particular entityparticular entity “ “tuples” or “rows” in relational DBMStuples” or “rows” in relational DBMS
FileFile Collection of records Collection of records “ “Relation” or “Table” in relational DBMSRelation” or “Table” in relational DBMS
Terms and ConceptsTerms and Concepts
KeyKey an attribute or set of attributes used to identify an attribute or set of attributes used to identify
or locate records in a fileor locate records in a file Primary KeyPrimary Key
an attribute or set of attributes that an attribute or set of attributes that uniquelyuniquely identifies each record in a fileidentifies each record in a file
Terms and ConceptsTerms and Concepts
Data AdministrationData Administration Responsibility for the overall management of data Responsibility for the overall management of data
resources within an organizationresources within an organization Database AdministrationDatabase Administration
Responsibility for physical database design and Responsibility for physical database design and technical issues in database managementtechnical issues in database management
Data StewardData Steward Responsibility for some subset of the organization’s Responsibility for some subset of the organization’s
data, and all of the interactions (applications, user data, and all of the interactions (applications, user access, etc.) for that dataaccess, etc.) for that data
Figure 1-11 Components of the database environment
Components of the Components of the Database EnvironmentDatabase Environment
CASE Tools – computer-aided software engineering Repository – centralized storehouse of metadata Database Management System (DBMS) – software for managing
the database Database – storehouse of the data Application Programs – software using the data User Interface – text and graphical displays to users Data Administrators – personnel responsible for maintaining the
database System Developers – personnel responsible for designing
databases and software End Users – people who use the applications and databases
Evolution of DB SystemsEvolution of DB Systems
Flat files - 1960s - 1980s Hierarchical – 1970s - 1990s Network – 1970s - 1990s Relational – 1980s - present Object-oriented – 1990s - present Object-relational – 1990s - present Data warehousing – 1980s - present Web-enabled – 1990s - present
Example of a DatabaseExample of a Database
The SQL Query Language
To find all supliers in London Select * FROM S Where city=“London” • To find just names and status, replace
the first line: SELECT sname, status