Introduction to Databases Chapter 1 20110307 cindy 2

+ Introduction to Databases 教育輪講 Chapter 1 2011/03/07 cindy

+ 2 Outline l Introduction l An Example l Characteristics of the Database Approach l Database users l Advantages of Using the DBMS Approach l A Brief History of Database Applications l When Not to Use a DBMS l Summary

+ 3 Introduction l Our daily activities that involve some interaction with a database

+ 4 Introduction l Traditional database applications n l Store textual or numeric information. Multimedia databases n Store images, audio clips, and video streams digitally.

+ 5 Introduction l l l Geographic information systems (GIS) Data warehouses and online analytical processing (OLAP) Real-time and active database technology

+ 6 Introduction l Database Definition n n l A collection of related data. Can be recorded and have implicit meaning. A database has the following implicit properties

+ 7 Introduction l A database n n n Represents some aspect of the real world. Is a logically coherent collection of data with some inherent meaning. Is designed, built, and populated with data for a specific purpose.

+ 8 Introduction l Database Management System (DBMS) n n l A collection of programs. Enables users to create and maintain a database. The Main Functions of DBMS n n Defining Constructing Manipulating Sharing

+ 9 Introduction l l Defining: involves specifying the data types, structures and constraints of the data to be stored in the database. Constructing: the process of storing the data on some storage medium that is controlled by the DBMS. Manipulating: includes functions such as querying, updating, and generating reports. Sharing: Allows multiple users and programs to access the database simultaneously.

+ 10 l Database System n We call the database and DBMS software together a database system.

+ 11 An Example l University database n l Concerning students, courses, grades … Database Records n n n STUDENT COURSE SECTION GRADE_REPORT PREREQUISITE STUDENT (Name, Student_number, Class, Major) COURSE (Course_name, Course_number, Credit_hours, Department) SECTION (Section_identifer, Course_number, Semester, Year, Instructor) GRADE_REPORT (Student_number, Section_identifier, Grade) PREREQUISITE (Course_number, Prerequisite_number)

+ 12 An Example l To Define This Database… n n Specify the structure of the records of each file by specifying the different types of data elements to be stored in each record. Specify a data type for each data element within a record. data element: an atomic unit of data that has precise meaning or precise semantics…

+ 13 l Notice n Records in the various files may be related. For example l So, we know… n Most medium-size and large database include many types of records and have many relationships among the records.

+ l Database structure and sample data 14

+ 15 l Database manipulation u n Querying u u n Updating u u Retrieve the transcripts of ‘Smith’ List the prerequisite of the ‘Database’ course Change the class of ‘Smith’ to sophomore Create a new section for the ‘Database’ course for this semester Enter a grade of ‘A’ for ‘Smith’ in the ‘Database’ course

+ 16 Characteristics of the DB Approach l The Comparison of Traditional File Processing and Database Approach Traditional File Processing Database Approach Each user defines and A single repository maintains implements the files needed for data that is defined once and a specific software application then accessed by various users. Each application is free to name data elements independently. The names or labels of data are defined once, and used repeatedly. Result in wasted storage space because of redundancy in Save more storage space. defining and storing data. Hard Easy to change.

+ 17 Characteristics of the DB Approach l The Main Characteristics of the DB Approach n n Self-describing Nature of a Database System. Insulation between programs and data, and data abstraction. Support of multiple of views of the data. Sharing of the data multiuser transaction processing.

+ 18 Self-Describing Nature of a Database System l Meta-data n n l The information which is stored in the catalog. Describes the structure of the primary database. DBMS catalog n n Used by the DBMS software. Used by database users who need information about the database structure.

+ 19 Insulation between Programs and Data, and Data Abstraction l Program-data independence n n DBMS access programs do not require changing as much as traditional file processing. The structure of data files is stored in the DBMS catalog separately from the access programs.

+ 20 Insulation between Programs and Data, and Data Abstraction l Program-operation independence n An operation (a function or method) is specified in two parts. u u Interface (or signature) includes the operation name and the data types of its arguments. Implement (or method) is specified separately and can be changed without affecting the interface.

+ 21 Insulation between Programs and Data, and Data Abstraction l Data abstraction n l The characteristic that allows program-data independence and program-operation independence. Data model n A type of data abstraction that is used to provide conceptual representation.

+ 22 Support of Multiple Views of the Data A database typically has many users, each of whom may require a different perspective or view of the database l View n A subset of the database or may contain virtual data that is derived from the database files but is not explicitly stored.

+ 23 Sharing of Database and Multiuser Transaction Processing l Concurrency control software n l l Several users trying to update the same data do so in a controlled manner so that the result is correct. Online transaction processing (OLTP) application A fundamental role of multiuser DBMS software is to ensure that concurrent transactions operate correctly and efficiently

+ 24 Sharing of Database and Multiuser Transaction Processing l Transaction n n n Central to many database applications. An executing program or process that includes one or more database accesses Isolation property Atomicity property Consistency property Durability property

+ 25 Actors on the Scene l Database Administrators (DBA) l Database Designers l End Users l System Analysts and Application programmers

+ 26 Actors on the Scene l Database Administrators (DBA) n n l Administering the resources. Authorizing access to the database. Coordinating and monitoring its user. Acquiring software and hardware resources. Database Designers n n Identifying the data to be stored in the DB. Choosing appropriate structures to represent and store this data.

+ 27 Actors on the Scene l End Users n Requiring access to the database for querying, updating, and generating reports. u u Casual end users Naïve or parametric end users Software engineers Standalone users

+ 28 Actors on the Scene l System Analysts n l Determine the requirements of end users. Application programmers n Implements specifications as programs, test, debug, document and maintain these canned transactions.

+ 29 Workers behind the Scene l l l DBMS system designers and implementers n Design and implement the DBMS modules and interfaces as a software package. Tool developers n Design and implement tools. Operators and maintenance personnel n Responsible for the actual running and maintenance of the hardware and software environment.

+ 30 Advantages of Using the DBMS Approach l Controlling redundancy n Redundancy in storing the same data multiple times leads to several problems. u u u l There is no need to perform a single logical update Storage space is wasted when the same data is stored repeatedly Files that represent the same data may become inconsistent. Restricting Unauthorized Access n Provide a security and authorization subsystem.

+ 31 Advantages of Using the DBMS Approach l l Providing Persistent Storage for Program Objects Providing Storage Structures and Search Techniques for Efficient Query Processing n Indexes Typically based on tree data structures or hash data structures that are suitably modified for disk search. u

+ 32 Advantages of Using the DBMS Approach l Providing Backup and Recovery n l The backup and recovery subsystem of the DBMS is responsible for recovery. Providing Multiple User Interfaces n Many types of users with varying levels of technical knowledge use a DBMS.

+ 33 Advantages of Using the DBMS Approach l l Representing Complex Relationships among Data n A data may include numerous varieties of data that are interrelated in many ways. Enforcing Integrity Constraints n Integrity constraints u n The simplest type of integrity constraint involves specifying a data type for each data. Key or uniqueness constraint u Specify uniqueness on data item values.

+ 34 Advantages of Using the DBMS Approach l Permitting Inferencing and Actions Using Rules n Deductive database systems u n Trigger u n Provide capabilities for defining deduction rules for inferencing new information from the stored database facts. A form of a rule activated by updates to the table. Stored procedures u u u More involved procedures to enforce rules Become a part of the overall database definition Invoked appropriately when certain conditions are met.

+ 35 Advantages of Using the DBMS Approach l Additional Implications of Using the Database Approach n n n Potential for Enforcing Standards Reduced Application Development Time Flexibility Availability of Up-to-Data Information Economies of Scale

+ 36 A Brief History of Database Applications l Early Database Applications Using Hierarchical and Network System n Large numbers of records of similar structure. Problems? n n Intermixing of conceptual relationships with the physical storage and placement of records on disk. Provide only programming language interfaces.

+ 37 A Brief History of Database Applications l Providing Data Abstraction and Application Flexibility with Relational Database n n l Separate the physical storage of data from its conceptual representation. Provide a mathematical foundation for data representation and querying. Object-Oriented Applications and the Need for More Complex Database n n Emerged in the 1980 s. Mainly used in specialized applications, such as engineering design, multimedia publishing.

+ 38 A Brief History of Database Applications l l l Interchanging Data on the Web for ECommerce Using XML Extending Database Capabilities for New Applications Database versus Information Retrieval

+ 39 When Not to Use a Database l The overhead costs of using a DBMS are due to the following n n n l High initial investment in hardware, software and training. The generality that a DBMS provides for defining and processing data. Overhead for providing security, concurrency control , recovery, and integrity functions. It’s prefer to use regular files when n n Simple, well-defined database applications that are not expected to change at all. Stringent, real-time requirements for some application programs that may not need because of DBMS overhead. Embedded system with limited storage capacity, where a generalpurpose DBMS would not fit. No multiple-user access to data.

+ 40 Summary l Definition l Characteristics l Database users l Advantages l Database history l When to use a DBMS when not to?

+ 41 Thank you for your attention!
- Slides: 41