Top Banner
CSCI 260 CSCI 260 Database Applications Database Applications Chapter 1 – Getting Chapter 1 – Getting Started Started
41
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSCI 260 Database Applications Chapter 1 – Getting Started.

CSCI 260CSCI 260

Database ApplicationsDatabase Applications

Chapter 1 – Getting StartedChapter 1 – Getting Started

Page 2: CSCI 260 Database Applications Chapter 1 – Getting Started.

22

CSCI 260 – Database AppsCSCI 260 – Database Apps

Database processing is the heart of all Database processing is the heart of all applications todayapplications today

The knowledge gained in this course will be The knowledge gained in this course will be valuable at job-hunting timevaluable at job-hunting time

Internet technology has tremendously amplified Internet technology has tremendously amplified the need for database knowledgethe need for database knowledge

Technology can be used inside organizations as Technology can be used inside organizations as well as outside for e-commerce applicationswell as outside for e-commerce applications

Page 3: CSCI 260 Database Applications Chapter 1 – Getting Started.

33

Chapter 1 ObjectivesChapter 1 Objectives

Know the potential problems with listsKnow the potential problems with lists Understand the reasons for using a databaseUnderstand the reasons for using a database Understand how related tables avoid the Understand how related tables avoid the

problems of listsproblems of lists Learn the components of database systemLearn the components of database system Learn the elements of a databaseLearn the elements of a database Learn the purpose of the database management Learn the purpose of the database management

system (DBMS)system (DBMS) Understand the functions of a database Understand the functions of a database

applicationapplication

Page 4: CSCI 260 Database Applications Chapter 1 – Getting Started.

44

Purpose of a DatabasePurpose of a Database

The purpose of a database is to keep The purpose of a database is to keep track of thingstrack of things

Unlike a list or spreadsheet, a database Unlike a list or spreadsheet, a database may store information that is more may store information that is more complicated than a simple listcomplicated than a simple list

Page 5: CSCI 260 Database Applications Chapter 1 – Getting Started.

55

Problems with Lists:Problems with Lists:RedundancyRedundancy

In a list, each row is intended to stand on In a list, each row is intended to stand on its own. As a result, the same information its own. As a result, the same information may be entered several timesmay be entered several timesFor Example: A list of Projects may include For Example: A list of Projects may include

the Project Manager’s Name, ID, and Phone the Project Manager’s Name, ID, and Phone Extension. If a particular person is managing Extension. If a particular person is managing 10 projects, his/her information would have to 10 projects, his/her information would have to be entered 10 timesbe entered 10 times

Page 6: CSCI 260 Database Applications Chapter 1 – Getting Started.

66

Problems with Lists:Problems with Lists:Multiple ThemesMultiple Themes

In a list, each row may contain information In a list, each row may contain information on more than one theme. As a result, on more than one theme. As a result, needed information may appear in the lists needed information may appear in the lists only if information on other themes is also only if information on other themes is also presentpresentFor Example: A list of Projects may include For Example: A list of Projects may include

Project Manager information (Name, ID, and Project Manager information (Name, ID, and Phone Extension) and Project information Phone Extension) and Project information (Name, ID, StartDate, Budget) in the same (Name, ID, StartDate, Budget) in the same row.row.

Page 7: CSCI 260 Database Applications Chapter 1 – Getting Started.

77

List Modification IssuesList Modification Issues

Redundancy and multiple themes Redundancy and multiple themes create modification problemscreate modification problemsDeletion problemsDeletion problemsUpdate problemsUpdate problems Insertion problemsInsertion problems

Page 8: CSCI 260 Database Applications Chapter 1 – Getting Started.

88

List Modification IssuesList Modification Issues

Page 9: CSCI 260 Database Applications Chapter 1 – Getting Started.

99

Addressing the Information Addressing the Information ComplexitiesComplexities

Relational databasesRelational databases are designed to are designed to address many of the information address many of the information complexity issuescomplexity issues

Page 10: CSCI 260 Database Applications Chapter 1 – Getting Started.

1010

Relational DatabasesRelational Databases

A relational database stores information in A relational database stores information in tables. Each informational topic is stored in its tables. Each informational topic is stored in its own tableown table

In essence, a relational database will break-up a In essence, a relational database will break-up a list into several parts. One part for each theme list into several parts. One part for each theme in the listin the list

A Project List would be divided into a A Project List would be divided into a CUSTOMER Table, a PROJECT Table, and a CUSTOMER Table, a PROJECT Table, and a PROJECT_MANAGER TablePROJECT_MANAGER Table

Page 11: CSCI 260 Database Applications Chapter 1 – Getting Started.

1111

Putting the Pieces Back Putting the Pieces Back TogetherTogether

In our relational database we broke apart In our relational database we broke apart our list into several tables. Somehow the our list into several tables. Somehow the tables must be tables must be joinedjoined back together back together

In a relational database, tables are joined In a relational database, tables are joined together using the value of the datatogether using the value of the data

If a PROJECT has a CUSTOMER, the If a PROJECT has a CUSTOMER, the Customer_ID is stored as a column in the Customer_ID is stored as a column in the PROJECT table. The value stored in this PROJECT table. The value stored in this column can be used to retrieve specific column can be used to retrieve specific customer information from the CUSTOMER customer information from the CUSTOMER tabletable

Page 12: CSCI 260 Database Applications Chapter 1 – Getting Started.

1212

Sounds likeSounds likeMore Work, Not LessMore Work, Not Less

A relational database is more complicated than a A relational database is more complicated than a listlist

However, a relational database minimizes data However, a relational database minimizes data redundancy, preserves complex relationships redundancy, preserves complex relationships among topics, and allows for partial dataamong topics, and allows for partial data

Furthermore, a relational database provides a Furthermore, a relational database provides a solid foundation for user forms and reports solid foundation for user forms and reports

Page 13: CSCI 260 Database Applications Chapter 1 – Getting Started.

1313

Relational Database ExampleRelational Database Example

Page 14: CSCI 260 Database Applications Chapter 1 – Getting Started.

1414

A Relational Database Solves the A Relational Database Solves the Problems of ListsProblems of Lists

Page 15: CSCI 260 Database Applications Chapter 1 – Getting Started.

1515

Page 16: CSCI 260 Database Applications Chapter 1 – Getting Started.

1616

Page 17: CSCI 260 Database Applications Chapter 1 – Getting Started.

1717

Page 18: CSCI 260 Database Applications Chapter 1 – Getting Started.

1818

Page 19: CSCI 260 Database Applications Chapter 1 – Getting Started.

1919

Page 20: CSCI 260 Database Applications Chapter 1 – Getting Started.

2020

Structured Query Language Structured Query Language (SQL)(SQL)

Structured Query Language (SQL)Structured Query Language (SQL) is is an international standard for creating, an international standard for creating, processing and querying database processing and querying database and their tablesand their tables

Many database applications use SQL Many database applications use SQL to retrieve, format, report, insert, to retrieve, format, report, insert, delete, and/or modify data for usersdelete, and/or modify data for users

Page 21: CSCI 260 Database Applications Chapter 1 – Getting Started.

2121

SQL ExampleSQL Example

Page 22: CSCI 260 Database Applications Chapter 1 – Getting Started.

2222

SQL Example (Continued)SQL Example (Continued)

SELECT CUSTOMER.CustomerName, CUSTOMER.Phone,

COURSE.CourseDate, ENROLLMENT.AmountPaid,

COURSE.Course, COURSE.Fee

FROM CUSTOMER, ENROLLMENT, COURSE

WHERE CUSTOMER.CustomerNumber

= ENROLLMENT.CustomerNumber

AND

COURSE.CourseNumber

= ENROLLMENT.CourseNumber;

Page 23: CSCI 260 Database Applications Chapter 1 – Getting Started.

2323

SQL Example (continued)SQL Example (continued)

Page 24: CSCI 260 Database Applications Chapter 1 – Getting Started.

2424

Database SystemsDatabase Systems

The four components of a The four components of a database database systemsystem are: are:UsersUsersDatabase ApplicationDatabase ApplicationDatabase Management System (DBMS)Database Management System (DBMS)DatabaseDatabase

Page 25: CSCI 260 Database Applications Chapter 1 – Getting Started.

2525

Components of a Database Components of a Database SystemSystem

Page 26: CSCI 260 Database Applications Chapter 1 – Getting Started.

2626

UsersUsers

A user of a database system willA user of a database system willUse a database application to track thingsUse a database application to track thingsUse forms to enter, read, delete and query Use forms to enter, read, delete and query

datadataProduce reportsProduce reports

Page 27: CSCI 260 Database Applications Chapter 1 – Getting Started.

2727

The DatabaseThe Database

A database is a A database is a self-describingself-describing collection of collection of relatedrelated records records

Self-describingSelf-describingThe database itself contains the definition of The database itself contains the definition of

its structureits structureMetadata is data describing the structure of Metadata is data describing the structure of

the database datathe database data Tables within a relational database are related to Tables within a relational database are related to

each othereach other

Page 28: CSCI 260 Database Applications Chapter 1 – Getting Started.

2828

The DatabaseThe Database

Page 29: CSCI 260 Database Applications Chapter 1 – Getting Started.

2929

Database Management Database Management System (DBMS)System (DBMS)

A database management system (DBMS) A database management system (DBMS) serves as an intermediary between serves as an intermediary between database applications and the databasedatabase applications and the database

The DBMS manages and controls The DBMS manages and controls database activitiesdatabase activities

The DBMS creates, processes and The DBMS creates, processes and administers the databases it controlsadministers the databases it controls

Page 30: CSCI 260 Database Applications Chapter 1 – Getting Started.

3030

Functions of a DBMSFunctions of a DBMS

Create databasesCreate databases Create tablesCreate tables Create supporting structuresCreate supporting structures Read database dataRead database data Modify database data (insert, update, delete)Modify database data (insert, update, delete) Maintain database structuresMaintain database structures Enforce rulesEnforce rules Control concurrencyControl concurrency Provide securityProvide security Perform backup and recoveryPerform backup and recovery

Page 31: CSCI 260 Database Applications Chapter 1 – Getting Started.

3131

Referential Integrity ConstraintsReferential Integrity Constraints

The DBMS will enforce many constraints The DBMS will enforce many constraints Referential integrity constraints ensure that the Referential integrity constraints ensure that the

values of a column in one table are valid based values of a column in one table are valid based on the values in another tableon the values in another table If a 5 was entered as a CustomerID in the PROJECT If a 5 was entered as a CustomerID in the PROJECT

table, a Customer having a CustomerID value of 5 table, a Customer having a CustomerID value of 5 must exist in the CUSTOMER tablemust exist in the CUSTOMER table

Page 32: CSCI 260 Database Applications Chapter 1 – Getting Started.

3232

Database ApplicationsDatabase Applications

A database application is a set of one or A database application is a set of one or more computer programs that serves as more computer programs that serves as an intermediary between the user and the an intermediary between the user and the DBMSDBMS

Page 33: CSCI 260 Database Applications Chapter 1 – Getting Started.

3333

Functions of Database Functions of Database ApplicationsApplications

Create and process formsCreate and process formsProcess user queriesProcess user queriesCreate and process reportsCreate and process reportsExecute application logicExecute application logicControl database applicationsControl database applications

Page 34: CSCI 260 Database Applications Chapter 1 – Getting Started.

3434

Functions of Database Functions of Database ApplicationsApplications

Page 35: CSCI 260 Database Applications Chapter 1 – Getting Started.

3535

Page 36: CSCI 260 Database Applications Chapter 1 – Getting Started.

3636

Page 37: CSCI 260 Database Applications Chapter 1 – Getting Started.

3737

Desktop Database SystemsDesktop Database Systems

Desktop database systems typically:Desktop database systems typically:Have one applicationHave one applicationHave only a few tablesHave only a few tablesAre simple in designAre simple in design Involve only one computerInvolve only one computerSupport one user at a timeSupport one user at a time

Page 38: CSCI 260 Database Applications Chapter 1 – Getting Started.

3838

Desktop Database SystemsDesktop Database Systems

Page 39: CSCI 260 Database Applications Chapter 1 – Getting Started.

3939

Organizational Database Organizational Database SystemsSystems

Organizational database systems typically:Organizational database systems typically:Support several users simultaneouslySupport several users simultaneously Include more than one applicationInclude more than one application Involve multiple computersInvolve multiple computersAre complex in designAre complex in designHave many tablesHave many tablesHave many databasesHave many databases

Page 40: CSCI 260 Database Applications Chapter 1 – Getting Started.

4040

Organizational Database SystemsOrganizational Database Systems

Page 41: CSCI 260 Database Applications Chapter 1 – Getting Started.

4141

Commercial DBMS ProductsCommercial DBMS Products

Example Desktop DBMS ProductsExample Desktop DBMS ProductsMicrosoft AccessMicrosoft Access

Example Organizational DBMS ProductsExample Organizational DBMS ProductsOracle’s OracleOracle’s OracleMicrosoft’s SQL ServerMicrosoft’s SQL Server IBM’s DB2IBM’s DB2