Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases.

Slides:



Advertisements
Similar presentations
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Advertisements

Database Management System MIS 520 – Database Theory Fall 2001 (Day) Lecture 13.
Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
1 7 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 7 DBMS Functions.
Introduction to Structured Query Language (SQL)
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Database Management: Getting Data Together Chapter 14.
DBMS Functions Data, Storage, Retrieval, and Update
Modern Systems Analysis and Design Third Edition
Information Technology in Organizations
Introduction to Structured Query Language (SQL)
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Chapter 3: Data Modeling
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Page 1 ISMT E-120 Introduction to Microsoft Access & Relational Databases The Influence of Software and Hardware Technologies on Business Productivity.
PHASE 3: SYSTEMS DESIGN Chapter 7 Data Design.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Concepts of Database Management, Fifth Edition
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 3 Objectives: Identifying and Eliminating Database.
Discovering Computers Fundamentals, 2012 Edition Your Interactive Guide to the Digital World.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 13 Database Management Systems: Getting Data Together.
ASP.NET Programming with C# and SQL Server First Edition
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
The University of Akron Dept of Business Technology Computer Information Systems DBMS Functions 2440: 180 Database Concepts Instructor: Enoch E. Damson.
Concepts of Database Management, Fifth Edition
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Chapter 1 Overview of Database Concepts Oracle 10g: SQL
Database Management Systems Accounting Information Systems, 5 th edition James A. Hall COPYRIGHT © 2007 Thomson South-Western, a part of The Thomson Corporation.
Chapter 15: Using LINQ to Access Data in C# Programs.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
Concepts and Terminology Introduction to Database.
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Lecture 2 An Overview of Relational Database IST 318 – DB Admin.
6 Chapter Databases and Information Management. File Organization Terms and Concepts Bit: Smallest unit of data; binary digit (0,1) Byte: Group of bits.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Concepts of Database Management, Fifth Edition
Lecture 12 Designing Databases 12.1 COSC4406: Software Engineering.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
Concepts of Database Management Seventh Edition
Using Special Operators (LIKE and IN)
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
Relational Database. Database Management System (DBMS)
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Chapter 16: Using Relational Databases Programming Logic and Design, Third Edition Comprehensive.
Database Management Supplement 1. 2 I. The Hierarchy of Data Database File (Entity, Table) Record (info for a specific entity, Row) Field (Attribute,
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
IAD 2263: System Analysis and Design Chapter 7: Designing System Databases, Interfaces and Security.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
IS 320 Notes for April 15, Learning Objectives Understand database concepts. Use normalization to efficiently store data in a database. Use.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Essentials of Systems Analysis and Design Fourth Edition Joseph S. Valacich Joey F.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
Introduction to Databases Dr. Osama AL Rababah. Objectives In this capture you will learn: Some common uses of database systems. The characteristics of.
P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 14 Using Relational Databases.
Lecture 4: Logical Database Design and the Relational Model 1.
LM 5 Introduction to SQL MISM 4135 Instructor: Dr. Lei Li.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
Chapter 4 Relational Databases
Database Design Chapter 7.
Presentation transcript:

Programming Logic and Design Fourth Edition, Comprehensive Chapter 16 Using Relational Databases

Programming Logic and Design, Fourth Edition, Comprehensive2 Objectives Understand relational database fundamentals Create databases and table descriptions Identify primary keys Understand database structure notation Understand the principles of adding, deleting, updating, and sorting records within a table

Programming Logic and Design, Fourth Edition, Comprehensive3 Objectives (continued) Write queries Understand relationships between tables and functional dependence between columns Recognize poor table design Understand anomalies, normal forms, and the normalization process Understand the performance and security issues connected to database administration

Programming Logic and Design, Fourth Edition, Comprehensive4 Understanding Relational Database Fundamentals Data hierarchy: stores data from smallest usable unit of data to the largest –Characters –Fields –Records –Files Database: –Has group of files needed to support an organization –Files in a database are called tables

Programming Logic and Design, Fourth Edition, Comprehensive5 Understanding Relational Database Fundamentals (continued) Data in tables can be arranged in rows and columns –Each row represents an entire record in the table

Programming Logic and Design, Fourth Edition, Comprehensive6 Understanding Relational Database Fundamentals (continued) Primary key (or key): –Uniquely identifies a record –May be composed of one or multiple columns Compound key: constructed from multiple columns

Programming Logic and Design, Fourth Edition, Comprehensive7 Understanding Relational Database Fundamentals (continued) Database Management System (DBMS) is software that allows you to: –Create table descriptions –Identify keys –Add, delete, and update records within a table –Sort records within a table by a specific field or fields –Write questions to select specific records for viewing –Write questions to combine information from multiple, related tables –Create reports –Secure the data

Programming Logic and Design, Fourth Edition, Comprehensive8 Creating Databases and Table Descriptions Creating a database requires planning and analysis –What data to store –How to divide the data between tables –How the tables will interrelate Designing a database table: –Determine what columns are required and name them –Determine the type of data in each column

Programming Logic and Design, Fourth Edition, Comprehensive9 Creating Databases and Table Descriptions (continued)

Programming Logic and Design, Fourth Edition, Comprehensive10 Identifying Primary Keys Identify a column or combination of columns to be the primary key Values of primary keys must be unique, such as: –Student ID number –Inventory part number –Social Security number

Programming Logic and Design, Fourth Edition, Comprehensive11 Identifying Primary Keys (continued) Primary key is used for: –Ensuring that multiple records with the same values cannot be added –Sorting the records in primary key order –Creating relationships between tables –Normalizing a database May need to use a multicolumn key to ensure unique values

Programming Logic and Design, Fourth Edition, Comprehensive12 Identifying Primary Keys (continued)

Programming Logic and Design, Fourth Edition, Comprehensive13 Understanding Database Structure Notation Table can be described: –With the table name with column names in parentheses Underline the primary key field(s)

Programming Logic and Design, Fourth Edition, Comprehensive14 Adding, Deleting, and Updating Records Within Tables Adding data –Data types must match the column definitions –Database software may not permit blank values Records can be deleted from tables Fields within records can be modified Maintaining correct data at all times is extremely important

Programming Logic and Design, Fourth Edition, Comprehensive15 Sorting the Records in a Table Can sort a table based on any column After sorting: –Records can be grouped by specific values or ranges –Aggregate values can be calculated (counts, sums, averages, etc.) Data retrieved from tables can be formatted for display

Programming Logic and Design, Fourth Edition, Comprehensive16 Creating Queries Query: a question presented to the database which results in data being returned Structured Query Language (SQL): a common language used to query a database SELECT-FROM-WHERE is the basic form of a query: –Select which columns to use –Select the table from which to retrieve the data –Select records where one or more conditions are met Wildcard symbol can be used to specify “any” or “all” Can create compound conditions using AND or OR

Programming Logic and Design, Fourth Edition, Comprehensive17 Creating Queries (continued)

Programming Logic and Design, Fourth Edition, Comprehensive18 Creating Queries (continued)

Programming Logic and Design, Fourth Edition, Comprehensive19 Understanding Table Relationships Relationship: a connection between two tables Relational database: a database containing relationships Join operation (or join): connecting two tables based on values in a common column Query returns data taken from each joined table 3 types of relationships: –One-to-many –Many-to-many –One-to-one

Programming Logic and Design, Fourth Edition, Comprehensive20 Understanding Table Relationships (continued)

Programming Logic and Design, Fourth Edition, Comprehensive21 Understanding One-to-Many Relationships One-to-many relationship: –A row in one table is related to one or more rows in another table –Most common type of table relationship Relationship can be based on one or more columns On one side of the relationship, a table’s primary key is used for the join On the other side, it may be a non-key column Foreign key: a field in a table which is also a primary key in another table

Programming Logic and Design, Fourth Edition, Comprehensive22 Understanding One-to-Many Relationships (continued)

Programming Logic and Design, Fourth Edition, Comprehensive23 Understanding Many-to-Many Relationships Many-to-many relationship: –Multiple rows in each table can correspond to multiple rows in the other table Use an additional table to contain the pairs of primary keys from each table These pairs form unique keys in the new table

Programming Logic and Design, Fourth Edition, Comprehensive24 Understanding Many-to-Many Relationships (continued)

Programming Logic and Design, Fourth Edition, Comprehensive25 Understanding One-to-One Relationships One-to-one relationship: –A row in one table corresponds to exactly one row in another table One-to-one relationships indicate that the tables could be combined into a single table Often keep the tables separate for security purposes

Programming Logic and Design, Fourth Edition, Comprehensive26 Recognizing Poor Table Design If tables are not designed correctly, the database may not support the needs of the application What are the shortcomings of this table design?

Programming Logic and Design, Fourth Edition, Comprehensive27 Understanding Anomalies, Normal Forms, and the Normalization Process Normalization: –Process of designing and creating a database structure that satisfies needs –Helps reduce duplication of data Data redundancy: unnecessary duplication of data Anomaly: irregularity in database design that causes problems

Programming Logic and Design, Fourth Edition, Comprehensive28 Understanding Anomalies, Normal Forms, and the Normalization Process (continued) Three common types of anomalies: –Update anomalies –Delete anomalies –Insert anomalies Update anomaly: when updating data in one table, you must update the same data in another table Delete anomaly: deleting a record causes other problems, such as loss of unrelated information Insert anomaly: inability to add a new record due to lack of related data

Programming Logic and Design, Fourth Edition, Comprehensive29 Understanding Anomalies, Normal Forms, and the Normalization Process (continued) Normalization removes redundancies and anomalies Three normal forms: –First normal form (or 1NF): eliminate repeating groups –Second normal form (or 2NF): eliminate partial key dependencies –Third normal form (3NF): eliminate transitive dependencies

Programming Logic and Design, Fourth Edition, Comprehensive30 First Normal Form Unnormalized: a table that contains repeating groups Repeating group: a subset of rows in a table that all depend on the same key After eliminating repeating class and classTitle :

Programming Logic and Design, Fourth Edition, Comprehensive31 First Normal Form (continued) When repeating groups are eliminated, you may have to change the key field if it is no longer unique Can use a compound key to solve this problem Atomic attributes: each attribute contains an undividable piece of data

Programming Logic and Design, Fourth Edition, Comprehensive32 Second Normal Form Partial key dependencies: when a column depends on only part of the key For 2NF: –Database must already be in 1NF –All non-key fields must be dependent on the entire primary key Eliminate partial key dependencies by creating multiple tables

Programming Logic and Design, Fourth Edition, Comprehensive33 Second Normal Form (continued)

Programming Logic and Design, Fourth Edition, Comprehensive34 Third Normal Form Transitive dependency: when the value of a non-key attribute determines or predicts the value of another non-key attribute For 3NF: –Database must already be in 2NF –No transitive dependencies Remove the attributes that are functionally dependent on the attribute that causes the transitive dependency

Programming Logic and Design, Fourth Edition, Comprehensive35 Third Normal Form (continued)

Programming Logic and Design, Fourth Edition, Comprehensive36 Third Normal Form (continued) All redundancies and anomalies have now been removed Determinant is allowed in 3NF if it is a candidate key Normalization summary: –1NF: no repeating groups –2NF: 1NF plus no partial key dependencies –3NF: 2NF plus no transitive dependencies

Programming Logic and Design, Fourth Edition, Comprehensive37 Database Performance and Security Issues A company’s data must be protected Data security includes: –Providing data integrity –Recovering lost data –Avoiding concurrent update problems –Providing authentication and permissions –Providing encryption

Programming Logic and Design, Fourth Edition, Comprehensive38 Providing Data Integrity Data integrity: –Data is accurate and consistent Database software must enforce data integrity

Programming Logic and Design, Fourth Edition, Comprehensive39 Recovering Lost Data Data loss can be caused by: –User mistakes –Hackers or other malicious users –Hardware problems –Fire, flood, or other natural disasters Recovery: returning the database to a correct form that existed before the problem occurred Can use a backup copy of the database with a record of all transactions to recover a database Transaction: a change made to data in the database

Programming Logic and Design, Fourth Edition, Comprehensive40 Avoiding Concurrent Update Problems Concurrent update problem: –When two users both need to make changes to the same record –If each user changes the data and saves the record, whose update will not be in the database? Lock: a mechanism to prevent changes to a database record for some period of time Solving concurrent update problem: –Use record-level locking –Make transactions off-line, and process as a batch

Programming Logic and Design, Fourth Edition, Comprehensive41 Providing Authentication and Permissions Database software must determine that a user is legitimate and is authorized to use the database Authentication techniques include: –Storing and verifying passwords –Using biometric data to identify users Permissions: settings that determine what actions a user is allowed to perform Authentication determines what permissions a user has

Programming Logic and Design, Fourth Edition, Comprehensive42 Providing Encryption Encryption: coding data into a format that humans cannot read Prevents use of the data by unauthorized users

Programming Logic and Design, Fourth Edition, Comprehensive43 Summary Database: collection of tables containing an organization's data Primary key: value that uniquely identifies a record Database management software allows you to add, delete, and update records in the database Query: question that selects data from database Database creation requires planning and analysis

Programming Logic and Design, Fourth Edition, Comprehensive44 Summary (continued) Primary key can consist of one or multiple columns Most data is in a constant state of change Can sort a table based on any column Can do aggregate calculations on data Normalization: designing a database to meet stated needs yet avoiding redundancies and anomalies Three forms of normalization are commonly used

Programming Logic and Design, Fourth Edition, Comprehensive45 Summary (continued) Database may be one of a company’s most important assets, so it must be secured Security issues: data integrity, recovery, avoiding concurrent update problems, authentication and permissions, and providing encryption