Concepts of Database Management Sixth Edition

Slides:



Advertisements
Similar presentations
Access Manual 4 By Elham S.Khorasani Ismail Guneydas Dhawala Kovuri.
Advertisements

Computer Concepts BASICS 4th Edition
Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
A Guide to SQL, Seventh Edition. Objectives Create a new table from an existing table Change data using the UPDATE command Add new data using the INSERT.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Introduction to Structured Query Language (SQL)
Database Management: Getting Data Together Chapter 14.
Concepts of Database Management Sixth Edition
Concepts of Database Management, 4th Edition, Pratt & Adamski
Introduction to Databases CIS 5.2. Where would you find info about yourself stored in a computer? College Physician’s office Library Grocery Store Dentist’s.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
A Guide to MySQL 7. 2 Objectives Understand, define, and drop views Recognize the benefits of using views Use a view to update data Grant and revoke users’
Introduction to Structured Query Language (SQL)
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
Concepts of Database Management Sixth Edition
Management Information Systems MS Access 2003 By: Mr. Imdadullah Lecturer, Department of M.I.S. College of Business Administration, KSU.
Microsoft Access 2010 Chapter 7 Using SQL.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Chapter 3 Maintaining a Database
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Chapter 6: Integrity and Security Thomas Nikl 19 October, 2004 CS157B.
ASP.NET Programming with C# and SQL Server First Edition
Working with Queries in Microsoft Access The Access Workbench: Section Three DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 3 rd Edition.
Concepts of Database Management Seventh Edition
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
Concepts of Database Management, Fifth Edition Chapter 4: The Relational Model 3: Advanced Topics.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
Database Technical Session By: Prof. Adarsh Patel.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Concepts of Database Management Seventh Edition
1 Database Administration. 2 Objectives  Understand, create, and drop views  Grant and revoke users’ privileges  Understand and obtain information.
Chapter 6 Database Administration
Concepts of Database Management Seventh Edition
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
1 Database Concepts 2 Definition of a Database An organized Collection Of related records.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Relational Database. Database Management System (DBMS)
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
1 Database Design and Development: A Visual Approach © 2006 Prentice Hall Chapter 8 DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH Chapter 8 Creating.
Microsoft Access 2010 Chapter 10 Administering a Database System.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
1 Chapter 6 Database Administration. 2 Introduction Database administration The process of managing a database Database administrator A person or an entire.
Maintaining a Database Access Project 3. 2 What is Database Maintenance ?  Maintaining a database means modifying the data to keep it up-to-date. This.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Concepts of Database Management Seventh Edition Chapter 1 Introduction to Database Management.
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
Lesson 4.  After a table has been created, you may need to modify it. You can make many changes to a table—or other database object—using its property.
DBAdmin D D D D D a a a a a t t t t t a a a a a b b b b b a a a a a s s s s s e e e e eAdministration / Embedded SQL by: Glen Orsburn Chapter 6.
Chapter 5 : Integrity And Security  Domain Constraints  Referential Integrity  Security  Triggers  Authorization  Authorization in SQL  Views 
Session 1 Module 1: Introduction to Data Integrity
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
A Guide to SQL, Sixth Edition 1 Chapter 5 Updating Data.
Constraints Advanced Database Systems Dr. AlaaEddin Almabhouh.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
3 A Guide to MySQL.
Information Systems Today: Managing in the Digital World
Microsoft Office Illustrated Fundamentals
A Guide to SQL, Eighth Edition
Databases and Information Management
Presentation transcript:

Concepts of Database Management Sixth Edition Chapter 4 The Relational Model 3: Advanced Topics

Objectives Define, describe, and use views Use indexes to improve database performance Examine the security features of a DBMS Discuss entity, referential, and legal-values integrity Concepts of Database Management

Objectives (continued) Make changes to the structure of a relational database Define and use the system catalog Discuss stored procedures and triggers Concepts of Database Management

Views View: application program’s or individual user’s picture of the database Less involved than full database Simplification Security Concepts of Database Management

Views (continued) Defining query: SELECT command that creates a view Indicates what to include in the view Query acts as a window into the database Does not produce a new table Query that involves a view DBMS does not execute the query in this form Query actually executed is created by merging this query with the query that defines the view Concepts of Database Management

FIGURE 4-1: Housewares view Views (continued) CREATE VIEW Housewares AS SELECT PartNum, Description, OnHand, Price FROM Part WHERE Class='HW' ; FIGURE 4-1: Housewares view Concepts of Database Management

FIGURE 4-2: Housewares view of the Premiere Products database Views (continued) FIGURE 4-2: Housewares view of the Premiere Products database Concepts of Database Management

Views (continued) To create a view in Access, create and save a query Changing field names in a view SQL: include the new field names in the CREATE VIEW command Access: precede the name of the field with the desired name, followed by a colon Row-and-column subset view Subset of rows and columns in an individual table Concepts of Database Management

FIGURE 4-3: Access query design of the Housewares view Views (continued) FIGURE 4-3: Access query design of the Housewares view Concepts of Database Management

Views (continued) Concepts of Database Management FIGURE 4-5: Access query design of the Housewares view with changed field names Concepts of Database Management

Views (continued) A view can join two or more tables Advantages of views Data independence Each user has his or her own view View should contain only fields required by the user Greatly simplifies user’s perception of database Security Concepts of Database Management

Indexes Conceptually similar to book index Increase data retrieval efficiency Record numbers automatically assigned and used by DBMS Index key: field or combination of fields on which index is built Advantages Makes some data retrieval more efficient Concepts of Database Management

FIGURE 4-10: Customer table with record numbers Indexes (continued) FIGURE 4-10: Customer table with record numbers Concepts of Database Management

FIGURE 4-11: Index for the Customer table on the CustomerNum field Indexes (continued) FIGURE 4-11: Index for the Customer table on the CustomerNum field Concepts of Database Management

Indexes (continued) Disadvantages Occupies space on disk DBMS must update index whenever corresponding data are updated Create an index on a field (or fields) when: Field is the primary key of the table Field is the foreign key in a relationship Field will be frequently used as a sort field Need to frequently locate a record based on a value in this field Concepts of Database Management

Indexes (continued) SQL command to create an index: Single-field index CREATE INDEX CustomerName ON Customer (CustomerName) ; Single-field index Key is a single field Also called a single-column index Multiple-field index More than one key field Also called a multiple-column index Concepts of Database Management

FIGURE 4-13: Creating an index on a single field in Access Indexes (continued) FIGURE 4-13: Creating an index on a single field in Access Concepts of Database Management

FIGURE 4-14: Creating a multiple-field index in Access Indexes (continued) FIGURE 4-14: Creating a multiple-field index in Access Concepts of Database Management

Security Prevention of unauthorized access to database Database administrator determines types of access various users can have SQL security mechanisms GRANT: provides privileges to users GRANT SELECT ON Customer TO Jones ; REVOKE: removes privileges from users REVOKE SELECT ON Customer FROM Jones Concepts of Database Management

Integrity Rules Two integrity rules must be enforced by a relational DBMS Integrity rules defined by Dr. E. F. Codd Entity integrity Referential integrity Concepts of Database Management

Entity Integrity No field that is part of primary key may accept null values To specify primary key in SQL: Enter a PRIMARY KEY clause in either an ALTER TABLE or a CREATE TABLE command To designate primary key in Access: Select primary key field in Table Design view Click the Primary Key button in the Tools group on the Table Tools Design tab Concepts of Database Management

Entity Integrity (continued) SQL command to specify a primary key: PRIMARY KEY (CustomerNum) FIGURE 4-15: Specifying a primary key in Access Concepts of Database Management

Entity Integrity (continued) SQL command when more than one field included: PRIMARY KEY (OrderNum, PartNum) FIGURE 4-16: Specifying a primary key consisting of more than one field in Access Concepts of Database Management

Referential Integrity Foreign key: field(s) whose value is required to match the value of the primary key for a second table Referential integrity: if table A contains a foreign key that matches the primary key of table B, the values of this foreign key must match the value of the primary key for some row in table B or be null To specify referential integrity in SQL: FOREIGN KEY clause in either the CREATE TABLE or ALTER TABLE commands Concepts of Database Management

Referential Integrity (continued) To specify a foreign key, must specify both: Field that is a foreign key Table whose primary key the field is to match Example: FOREIGN KEY (RepNum) REFERENCES Rep In Access, specify referential integrity while defining relationships Concepts of Database Management

Referential Integrity (continued) FIGURE 4-18: Specifying referential integrity in Access Concepts of Database Management

Referential Integrity (continued) FIGURE 4-19: Referential integrity violation when attempting to add a record Concepts of Database Management

Legal-Values Integrity Legal values: set of values allowable in a field Legal-values integrity: no record can exist with a value in the field other than one of the legal values SQL CHECK clause enforces legal-values integrity Example: CHECK (CreditLimit IN (5000, 7500, 10000, 15000)) Concepts of Database Management

Legal-Values Integrity (continued) Access Validation rule: must be followed by data entered Validation text: informs user of the reason for rejection of data that violates the rule Concepts of Database Management

Legal-Values Integrity (continued) FIGURE 4-21: Specifying a validation rule in Access Concepts of Database Management

Structure Changes Examples of changes to database structure Adding and removing tables and fields Changing characteristics of existing fields Creating and dropping indexes SQL ALTER TABLE command changes table’s structure To add a new field to the Customer table: ALTER TABLE Customer ADD CustType CHAR(1) ; Concepts of Database Management

Structure Changes (continued) FIGURE 4-22: Adding a field in Access Concepts of Database Management

Structure Changes (continued) Changing properties of existing fields ALTER TABLE Customer CHANGE COLUMN CustomerName TO CHAR(40) ; Deleting a field from a table ALTER TABLE Part DELETE Warehouse DROP TABLE command deletes a table DROP TABLE SmallCust Concepts of Database Management

Structure Changes (continued) FIGURE 4-23: Changing a field property in Access Concepts of Database Management

Structure Changes (continued) FIGURE 4-24: Dialog box that opens when a field in Access is deleted Concepts of Database Management

Structure Changes (continued) FIGURE 4-25: Deleting a table in Access Concepts of Database Management

Making Complex Changes Some changes might not be allowed by your DBMS In these situations, you can: Use CREATE TABLE command to describe the new table Insert values into it using INSERT command combined with a SELECT clause SELECT INTO command can create the new table in a single operation Concepts of Database Management

System Catalog System catalog (or catalog) Contains information about tables in the database Maintained automatically by DBMS Example catalog has two tables Systables: information about the tables known to SQL Syscolumns: information about the columns or fields within these tables Concepts of Database Management

System Catalog (continued) Other possible tables Sysindexes: information about indexes Sysviews: information about views Catalog can be used to determine information about the structure of the database Documenter: allows user to print detailed documentation about any table, query, report, form, or other object in the database Concepts of Database Management

Stored Procedures Client/server system Client Database resides on a computer called the server Users access database through clients Client Computer connected to a network Has access through server to the database Concepts of Database Management

Stored Procedures (continued) Special file used to store a query that is run often Placed on the server Improves overall performance Convenience Concepts of Database Management

Stored Procedures (continued) MySQL Delimiter: semicolon at the end of a MySQL command Need to temporarily change the delimiter for a stored procedure To use a stored procedure: CALL followed by the procedure name Access does not support stored procedures Concepts of Database Management

Triggers Action that occurs automatically in response to an associated database operation such as an INSERT, UPDATE, or DELETE command Stored and compiled on the server Need to temporarily change the delimiter Access does not support triggers Concepts of Database Management

Summary Views give each user his or her own view of the data in a database Indexes facilitate data retrieval from the database Security is provided in SQL systems using the GRANT and REVOKE commands Entity integrity: no field that is part of the primary key can accept null values Referential integrity: value in any foreign key field must be null or must match an actual value in the primary key field of another table Concepts of Database Management

Summary (continued) Legal-values integrity: value entered in a field must be one of the legal values that satisfies some particular condition ALTER TABLE command allows you to add fields to a table, delete fields, or change the characteristics of fields In Access, change the structure of a table by making the changes in the table design DROP TABLE command lets you delete a table from a database Concepts of Database Management

Summary (continued) In Access, delete a table by selecting the Delete command on the table’s shortcut menu in the Navigation Pane System catalog stores information about the structure of a database Stored procedure: query saved in a file that users can execute later Trigger: action that occurs automatically in response to an associated database operation such as an INSERT, UPDATE, or DELETE Concepts of Database Management