etec 100 information technology lecture introduction to database
Post on 19-Dec-2015
219 views
TRANSCRIPT
Learning ObjectivesLearning Objectives
Define and understand the following Define and understand the following terms: terms: data, information, database, database data, information, database, database management system (DBMS), database management system (DBMS), database system, metadatasystem, metadata
Compare and contrast conventional file Compare and contrast conventional file systems and database systems. Identify systems and database systems. Identify advantages of database approach over advantages of database approach over traditional file systemstraditional file systems
What is database? Database:Database: An An organizedorganized collection of collection of logically relatedlogically related data data
Data:Data: Known facts that could be recorded and stored on computer Known facts that could be recorded and stored on computer media media
Facts could be in any format: text, graphics, images…Facts could be in any format: text, graphics, images…
Information:Information: Processed data that could be used to increase the Processed data that could be used to increase the knowledge of the userknowledge of the user
Closely related to data, but differentClosely related to data, but different View data as “raw material” and information as “intermediate product”View data as “raw material” and information as “intermediate product” The final product is “knowledge”The final product is “knowledge”
Data, Information and Knowledge
Data Information
Taurus
Ann
a B
erge
r
John Smith
Ted Martin
Amex G
old
50,0
00
234
wirelessB.A.
A. Berger M. JonesT. MartinJ. Smith
50,00046,800 29,20075,500
ShoesScarvesJewelry
Groceries
shoes
MoUQty
IncomeEducation
®
Some of the images above come from a presentation
given by:
Database Queries ?
Knowledge &Customer Insight
A. Berger is mostlikely to buy new product
T. Martin is profitablecustomer and is likely to switch carriers
Databases Databases
Interact with DBs many times in a dayInteract with DBs many times in a day Database processing integral part of many Database processing integral part of many
businessesbusinesses Keep track of things (what sort of things?)Keep track of things (what sort of things?)
History of data collection History of data collection methodsmethods
Manual SystemManual System File SystemFile System Database SystemDatabase System
Manual Filling SystemsManual Filling Systems
Before computerBefore computer: Manual Filing Systems: Manual Filing Systems Still used in many everyday activitiesStill used in many everyday activities Usually organize data in a logical wayUsually organize data in a logical way Ex;bills……..Ex;bills……..
ProblemsProblems with Manual Filling Systems with Manual Filling Systems Small –scaleSmall –scale Hard to analyze: ‘ How many students enrolled in Hard to analyze: ‘ How many students enrolled in
MIS ?MIS ?
Traditional File-BasedTraditional File-Based processing processing
Application programs were written Application programs were written specifically for the data file structurespecifically for the data file structure that was to be used, so:that was to be used, so:
A change in the data file structure A change in the data file structure required change in an application required change in an application program(s) that needed that dataprogram(s) that needed that data
File Processing Systems: An exampleFile Processing Systems: An example
Data Entry File
Management Programs Data Files
File Report Programs
End Users
Separated systems, separated files, separated data
Both file management programs and file report programs have describe WHAT data to write / read and HOW to do that
File Processing Systems: ProblemsFile Processing Systems: Problems
Isolation of Data/ Limited Data Sharing
Isolation between departments file systems Isolation in a department file system:
Duplication of Data
Duplicated data waste storage space
Duplicated data result in loss of data integrity
Lack of Data Independence If we change the data type of address from 40 characters to 41
characters, all related programs have to change accordingly
Database Systems: Basic TermsDatabase Systems: Basic Terms DatabaseDatabase:: An organized collection of logically related dataAn organized collection of logically related data
Database Management Systems (DBMS):Database Management Systems (DBMS): A A softwaresoftware package package to facilitate the creation and maintenance of a to facilitate the creation and maintenance of a databasedatabase. .
Database system:Database system: a a computerized record-keeping systemcomputerized record-keeping system, , containing containing databasedatabase and and DBMSDBMS as well as some other as well as some other components.components.
Four components: Users, Software, Hardware, DataFour components: Users, Software, Hardware, Data
Database Systems: Basic TermsDatabase Systems: Basic Terms
Database
DBMS
“How” to get
Application Programs
“What” to get
End usersinteract
Application Programmers
Database Administrators
Database Designers
develop
maintain
design
Software
Users
Data
Database Systems: AdvantagesDatabase Systems: Advantages
Data are stored in a central repository, managed by Data are stored in a central repository, managed by DBMSDBMS
Data sharing is easyData sharing is easy Reduce duplication to minimum: Reduce duplication to minimum: oneone table for each entity table for each entity Inconsistency can be avoided to some extent by enforcement Inconsistency can be avoided to some extent by enforcement
of of integrity constraintsintegrity constraints
Metadata offers data abstractionMetadata offers data abstraction Data independence: If format needs to be changed, simply Data independence: If format needs to be changed, simply
update the metadata. Application programs are not affectedupdate the metadata. Application programs are not affected Structural independence: similar to the above Structural independence: similar to the above
Data Elements in a DatabaseData Elements in a Database
User User datadata (files) (files) relations in a table format (e.g. Relational Database)relations in a table format (e.g. Relational Database)
MetadataMetadata (systems tables) (systems tables)data about data, data dictionarydata about data, data dictionarymeaning of terms, description of structure etc.meaning of terms, description of structure etc.
IndexesIndexes (overhead data) (overhead data)improves performance and accessibilityimproves performance and accessibility
Application MetadataApplication Metadata structure & format of forms, reports, & queries etc.structure & format of forms, reports, & queries etc.
Database Development ProcessDatabase Development Process
Requirement Analysis Requirement Analysis
Conceptual Design
Logical Design
Physical Design
Implementation
Maintenance
Database Development ProcessDatabase Development Process
Requirements AnalysisRequirements Analysis Collect and Analyze the requirements of the users.Collect and Analyze the requirements of the users.
Conceptual DesignConceptual Design Design a Design a conceptualconceptual model, e.g., ER model. model, e.g., ER model.
Logical DesignLogical Design Translate the conceptual model into the Translate the conceptual model into the logicallogical model model NormalizationNormalization..
Physical DesignPhysical Design Define the database and write application programsDefine the database and write application programs..
ImplementationImplementation Write, test, and install programs that process the databaseWrite, test, and install programs that process the database
MaintenanceUseMaintenanceUse maintain, and maintain, and “tune”“tune” the database the database
Relational DatabaseRelational Database
A A relational databaserelational database is one in which the is one in which the data consists of a collection of tables data consists of a collection of tables related to each other through common related to each other through common values.values.
The two most prominent characteristics of The two most prominent characteristics of a relational database are a relational database are data stored in tablesdata stored in tables relationships between tablesrelationships between tables
RelationRelation Two-dimensional tableTwo-dimensional table Rows are Rows are tuplestuples Columns are Columns are attributesattributes
Equivalent Terms:Equivalent Terms:
Characteristics of a Characteristics of a relationrelation
a a relationrelation has a has a unique nameunique name within same within same DBDB each each cellcell contains contains one single valueone single value each each attributeattribute within a given relation has a within a given relation has a distinct distinct
namename valuesvalues of an attribute are from the of an attribute are from the same domainsame domain orderorder of attributes has of attributes has no significanceno significance orderorder of of rows rows has has no significanceno significance no duplicateno duplicate rowsrows
Relational Database KeysRelational Database Keys Candidate keyCandidate key Primary keyPrimary key: candidate key selected to : candidate key selected to
uniquely uniquely identify all table rowsidentify all table rows Foreign keyForeign key: attributes(s) in one table whose : attributes(s) in one table whose
values must match primary values must match primary key in key in another tableanother table
Referential Referential IntegrityIntegrity RRuleule
IIf f a foreign key existsa foreign key exists in a relation, in a relation,
eithereither
the foreign key value the foreign key value must match a candidate key must match a candidate key valuevalue of some tuple in its home relation of some tuple in its home relation
oror
the foreign key the foreign key valuevalue must be wholly nullmust be wholly null
TThereforeherefore:-:- if B references A if B references A then Athen A must existmust exist
Schema Schema
A A schemaschema is an abstract representation of is an abstract representation of database entities and objects. A schema database entities and objects. A schema helps us design a database helps us design a database diagrammatically before we start creating diagrammatically before we start creating it. it.
QueryQuery
Requests for information from a database are Requests for information from a database are made in the form of a made in the form of a queryquery. .
The set of rules for constructing queries is The set of rules for constructing queries is known as a known as a query languagequery language. .
query language called query language called SQLSQL (structured query (structured query language) language)
For example, the query -requests all recordsfrom For example, the query -requests all recordsfrom customer table in which the NAME field is customer table in which the NAME field is SMITH and the AGE field is greater than 35. SMITH and the AGE field is greater than 35.
SQLSQL (structured query language) (structured query language)
For example, the query -requests all For example, the query -requests all recordsfrom recordsfrom customercustomer table in which the table in which the NameName field is SMITH and the field is SMITH and the AgeAge field is field is greater than 35. greater than 35.
SELECT ALL SELECT ALL
FROM CustomerFROM Customer
WHERE Name = "SMITH" and age > 35 WHERE Name = "SMITH" and age > 35