Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,

Similar presentations


Presentation on theme: "Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,"— Presentation transcript:

1 Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file, databases, data warehouse 2.Database models Relational databases, Hierarchical, Network, Object-oriented Data integrity 3.Database management systems and database features Creating a database, Data dictionary, Data maintenance, Data retrieval: Queries, Reports, Concurrency control, Security, Backup and recovery 4.Using database Creating the database, Determining the table structure, Setting up the file structure, Entering the data, Using the database

2 2Module 4: database The Hierarchy of Data Field – The smallest meaningful unit of data E.g. LAST NAME, FIRST NAME, STREET, CITY, STATE, ZIPCODE E.g. LAST NAME, FIRST NAME, STREET, CITY, STATE, ZIPCODE Record – the set of fields containing data E.g. AKERS, TED, 4302 LEMON AVE. OAKLAND, CA, 94709 E.g. AKERS, TED, 4302 LEMON AVE. OAKLAND, CA, 94709 File – a collection of related records

3 3Module 4: database Files and Databases Traditionally, information systems were developed with a file processing approach A database is an organized collection of information or data. Database approach creates separate files for each entity

4 4Module 4: database File System Approach Each application had its own file Data was not shared among applications Data was not shared among applications Resulted in a great deal of data redundancy, the repetition of the same data values Increased the risk of inaccurate data Increased the risk of inaccurate data Increased the amount of storage space needed Increased the amount of storage space needed

5 5Module 4: database The Database Approach A collection of related tables In database technology, a file is called a table In database technology, a file is called a table Each entity is stored in a separate table Each entity is stored in a separate table Tables are linked by a relationship between primary and foreign keys Tables are linked by a relationship between primary and foreign keys

6 6Module 4: database Primary Key A field that uniquely identifies a record SalesID can be a primary key for the Salesperson table SalesID can be a primary key for the Salesperson table Once a SalesID appears in the table, no other salesperson can have that ID Once a SalesID appears in the table, no other salesperson can have that ID

7 7Module 4: database Foreign Key A field in one table that is a primary key in another table SalesID can be used in the Customer table to identify the salesperson who serves that customer SalesID can be used in the Customer table to identify the salesperson who serves that customer The same SalesID can appear in many customer records (a salesperson can serve many customers) The same SalesID can appear in many customer records (a salesperson can serve many customers)

8 8Module 4: database Database Models Define the way a database organizes data Four main models Relational Relational Hierarchical Hierarchical Network Network Object-oriented Object-oriented

9 9Module 4: database Relational Model Data organized in table format Columns represent fields Columns represent fields Rows represent records Rows represent records Tables related by primary/foreign key relationship Most current database development uses this model

10 10Module 4: database Hierarchical Model Arranges data in hierarchical “parent-child” relationship, i.e. in a tree structure: Each parent record can have many child records Each parent record can have many child records Each child record has only one parent record Each child record has only one parent record Complex and inflexible

11 11Module 4: database Network Model Arranges data in complex network of “parent-child” relationships Each parent record can have many child records Each parent record can have many child records Each child record can have many parent records Each child record can have many parent records Complex and inflexible

12 12Module 4: database Object-Oriented Model Designed to deal with complex data types Focuses on the object An object represents an entity An object represents an entity Represents data about that entity and the types of operations that change that entity Represents data about that entity and the types of operations that change that entity

13 13Module 4: database Data Integrity Refers to the degree to which data is accurate and reliable Integrity constraints – rules all data must follow If integrity constraints are not followed, the data is unreliable If integrity constraints are not followed, the data is unreliable

14 14Module 4: database Integrity Constraints Define acceptable values for a field For example, the value of a month cannot be greater than 12 For example, the value of a month cannot be greater than 12 Primary keys cannot be duplicated Foreign keys cannot be used unless they exist as a primary key A SalesID that is used in the customer table must exist as a primary key in the salesperson table A SalesID that is used in the customer table must exist as a primary key in the salesperson table

15 15Module 4: database Database Management Database Management System (DBMS) – A software allows you to create a database and enter, modify, and retrieve data as needed Available at all levels Sophisticated systems for a mainframe environment. E.g. Oracle, IBM DB2 Sophisticated systems for a mainframe environment. E.g. Oracle, IBM DB2 Inexpensive, easy-to-use personal computer systems. MySql, MS Access, MS SQL Server Database Inexpensive, easy-to-use personal computer systems. MySql, MS Access, MS SQL Server Database Access through Web

16 16Module 4: database Database Features Data dictionary Data maintenance Data retrieval Concurrency control Security Backup and recovery

17 17Module 4: database Data Dictionary Stores data about the tables and fields within the database For each table, it stores the table name and relationships to other tables For each table, it stores the table name and relationships to other tables For each field, it records information about that field For each field, it records information about that field Also called a catalog

18 18Module 4: database Data Maintenance Three basic operations Adding new data Adding new data Modifying existing data Modifying existing data Deleting data Deleting data Two methods for performing operations Interacting directly with the DBMS working on table Interacting directly with the DBMS working on table Using programs to access the data using special commands e.g., working on database forms, web forms Using programs to access the data using special commands e.g., working on database forms, web forms

19 19Module 4: database Data Retrieval Involves extracting the desired data Two primary forms of data retrieval Queries Queries Reports Reports

20 20Module 4: database Queries You present a set of criteria; the DBMS selects matching data from the database Use a query language Structured Query Language (SQL) is supported by most relational databases Structured Query Language (SQL) is supported by most relational databases Query-by-example (QBE) uses a graphical interface to generate the SQL Query-by-example (QBE) uses a graphical interface to generate the SQL Display results in a table-like grid Display results in a table-like grid

21 21Module 4: database SQL Uses English-like statements SELECT specifies the field(s) to be selected SELECT specifies the field(s) to be selected FROM specifies the table(s) containing the fields FROM specifies the table(s) containing the fields JOIN specifies the relationship between tables JOIN specifies the relationship between tables WHERE specifies the criteria that must be met WHERE specifies the criteria that must be met

22 22Module 4: database Query by Example User adds tables to query User drags fields down into grid at bottom of window User drags fields down into grid at bottom of window Criteria can be added by typing them in the Criteria row of the grid Criteria can be added by typing them in the Criteria row of the grid Use can execute the query by clicking an icon on a toolbar

23 23Module 4: database Query Results Retrieved records are displayed as rows Fields specified in the select clause are displayed as columns

24 24Module 4: database Reports Provide a formatted presentation of data from the database Allow you to group reports and total by group, if desired Allow you to group reports and total by group, if desired Normally contain more data than queries Normally contain more data than queries Reports are designed with a report generator

25 25Module 4: database Concurrency Control Manages simultaneous database users If several users tried to update the same record at the same time, updates might not be processed correctly If several users tried to update the same record at the same time, updates might not be processed correctly Employs a record-locking scheme Once a user accesses a record, it is locked until the first update is complete Once a user accesses a record, it is locked until the first update is complete

26 26Module 4: database Security Many security features are built into most DBMS software Users can be required to enter a user ID and password Users can be required to enter a user ID and password Each user ID may have different access to the data Each user ID may have different access to the data Read-only – permits the user to look at the data but not change it Update – permits the user to make changes to the data No privileges – user can not read or update the data

27 27Module 4: database Backup and Recovery Backup – a copy of the database Backups should be made periodically Backups should be made periodically Recovery – replaces a damaged database with the good backup

28 28Module 4: database Creating and Using a Database Creating the database Determining the table structure Setting up the file structure Entering the data Using the database

29 29Module 4: database Creating the Database Consider your needs Reports you will need Reports you will need Inquiries you will want to make Inquiries you will want to make

30 30Module 4: database Determining the Table Structure Sketch the table structure – what kind of data is needed in each column Determine characteristics of field Field name Field name Each field must have a unique field name Field type Field type Field width Field width The maximum number of characters, including decimal places

31 31Module 4: database Field Types Character fields – contain descriptive data Numeric fields – contain numbers used for calculation Specify the number of decimal places Specify the number of decimal places Date fields Logical fields – keep track of true/false or yes/no conditions

32 32Module 4: database Setting Up the File Structure Design the structure for each table Define the table Define the table Define each field in the table Define each field in the table Define primary key Define primary key Set up the table in design view

33 33Module 4: database Entering the Data Enter data into the tables in datasheet view Enter data into the tables by using a graphical form

34 34Module 4: database Using the Database Many operations can be performed to view and modify the data List the records List the records List specific fields List specific fields Make a query Make a query Modify the data Modify the data

35 35Module 4: database List the Records Displays the table in datasheet view Displays all rows and all columns Displays all rows and all columns Can be displayed on monitor or printed

36 36Module 4: database List Specific Fields Displays only the fields you want to view Use SQL to select the desired fields

37 37Module 4: database Query Use SQL or query-by- example to produce a query Use relational operator to define criteria Use relational operator to define criteria Can be displayed on monitor or printed Can be displayed on monitor or printed Can be formatted into a report Can be formatted into a report

38 38Module 4: database Modify the Data Add new records Update (make changes to) an existing record Delete records


Download ppt "Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,"

Similar presentations


Ads by Google