Microsoft Access 2 Database Creation and Management.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2.1: Relational Databases.
Advertisements

© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
Microsoft Access.
MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Microsoft Office 2013 ®® Access Tutorial 2 Building a Database and Defining Table Relationships.
Microsoft Access 3 Database Creation and Management.
Database Creation and Management
MS-Access XP Lesson 2. Input Mask Property 1.Field : Phone No Data Type : Number Input Mask : Character 0 represent a single digit and phone.
Microsoft Office 2010 Access Chapter 1 Creating and Using a Database.
Microsoft Access 3 Database Creation and Management.
Access Lesson 2 Creating a Database
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Chapter 1 Databases and Database Objects: An Introduction
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Access Tutorial 1 Creating a Database
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
Define Table Relationships—1 of 3 One of the most powerful features of a relational database management system, such as Access, is its ability to define.
Database Creation and Management
Chapter 3 Maintaining a Database
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Access Lesson 2 Creating a Database
Microsoft Access – Tutorial 3
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Microsoft Access 2 Database Creation and Management.
Access Tutorial 2 Building a Database and Defining Table Relationships
Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select.
XP Chapter 2 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Building The Database Chapter 2 “It is only the farmer.
Microsoft Access 3 Database Creation and Management.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
Microsoft Access – Tutorial 2 Designing Databases In this tutorial, we will create a new database create a new table import tables from an existing database.
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
Examining data using Microsoft Access Queries Using Criteria and Calculations SESSION 3.2 This section covers specifying an exact match condition in a.
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
Microsoft Office 2013 ®® Access Tutorial 2 Building a Database and Defining Table Relationships.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T6: Basic Skills and Tools Using Access 2010 Business Driven Technology.
® Microsoft Office 2013 Access Creating a Database.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
IBS 520 Introduction to Internet Technology Database Fundamentals Week 4.
Microsoft Access 4 Database Creation and Management.
Microsoft Office 2013: In Practice Chapter 2 Using Design View, Data Validation, and Relationships Copyright © 2014 by The McGraw-Hill Companies, Inc.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
1 CHƯƠNG 4 Creating Relational Databases Understanding Table Relationships Example: This database tracks customers and their orders in two separate.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
Pasewark & Pasewark 1 Access Lesson 2 Creating a Database Microsoft Office 2007: Introductory.
Work with Tables and Database Records Lesson 3 © 2014, John Wiley & Sons, Inc.Microsoft Official Academic Course, Microsoft Word Microsoft Access.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
Access Tutorial 2 Building a Database and Defining Table Relationships
New Perspectives on Microsoft Access 2016
and Defining Table Relationships
Tutorial 3 – Querying a Database
Microsoft Office Access 2003
Access Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships
Grauer and Barber Series Microsoft Access Chapter One
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

Microsoft Access 2 Database Creation and Management

Creating a Order table Barbara wants to track each order data, which has been placed by each restaurant customer. This data includes the orders billing date and invoice amount. Barbara is asking you to create a second table in the Restaurant 1 database to store the order data and the table name should be Order.

Creating a Order table Use Design view Datasheet view by the practice on the class website. Case sensitive NUMBER vs. number Exact match of field names for Foreign Key Use tab key to enter data when you enter data in datasheet view.

Access data (field) type Make certain the field type you select matches the data to be held in that field.

Access data (field) type (cont) Additional Access field types.

Creating the Order table Field NameData TypeDescriptionField Properties OrderNumTextprimary keyField size (3), Required (Yes) CustomerNumTextforeign keyField size (3) BillingDateDate/Time PlacedByTextperson who placed order Field size (25) InvoiceAmtCurrency

Adding Records to a Table Enter data sequentially in Datasheet view Do not jump from field to field Use tab key to enter data OrderNumCustomerNumBillingDatePlacedByInvoiceAmt /15/2001Mike Smith$1, /15/2001Matt Davis$854.00

Modifying a Table From the Order table Delete the PlacedBy field Move the BillingDate field to the end of the table Insert the Paid as a new field between CustomerNum and InvoiceAmt (position) fields data type: Yes/No default value: No (means unpaid) Add following data to each filed: 211, 201, paid (mark the check box using space bar), $703.50, 01/15/2001

Table Assignment: Creating Table Barbara needs a database to track the coffee products offered by Valle Coffee. She asks you to create the database by completing the following: In the initial Microsoft Access dialog box, click the blank Access database option button, and then click OK button. Click the Create button the new database. YOUR LAST NAME DB file name Display the Table window in Design view (if necessary), and then create a table using the table design shown in the next slide.

Table Assignment: Creating Table Specify ProductCode as the primary key, and then save the table as Product. Add the product records shown in next slide table to the Product table. (Hint: You must type the decimal point when entering the Price field values.) Field NameData TypeDescriptionField Properties ProductCodeTextPrimary KeyField size (4), Required: Yes CoffeeCodeTextForeign KeyField size (4) PriceCurrencyPrice for this product DecafTextD if decaf, Null if regular Field size (1), Default Value: D BackOrderedYes/Noback-ordered from supplier? Default Value: No

Table Assignment: Creating Table Add a new field between the CoffeeCode and Price fields, using these properties; Field Name:WeightCode Data Type: Text Description: foreign key Field Size:1 Move the Decaf field so that it appears between the WeightCode and Price fields. ProductCodeCoffeeCodePriceDecafBackOrdered 2316JRUM8.99 Yes 9754HAZL40.00DYes 9309COCO9.99DNo

Table Assignment: Creating Table Enter these WeightCode values for the three records: A for ProductCode 2316, A for ProductCode 9309, and E for ProductCode Add a record to the Product datasheet with these field values: ProductCode:9729 CoffeeCode: COLS WeightCode:E Decaf:D Price:39.75 BackOrdered:Yes

Data Integrity (Rule for PK) No null value can be allowed. No two records can have the same primary key. No two CSUB students can have same ID number. PK can be composite key Example on class web page Composite PK Example More than one field can be used as a PK (composite) CSUB: student ID + SS# Exam: ONLY single primary key; No composite

PK as FK FK: A field that connects one table logically with another table (refer to the next slide). A PK also can be used as a FK. Example on class web page PK as FK there are two tables… Primary table: customer table Related table: Shipping Address table Exam: No PK as FK, ONLY single PK & FK

Relating tables using PK and FK On Access, the Employer table is called Primary table because it includes the primary key. On Access, the Position table is called related table. Because it includes the foreign key.

Access is a relational database Access allows you to form relationships between the tables; thats why its called a relational database The simplest way to create a relationship Look for identical field names between tables. Tables can be joined in three ways; one-to-one, one- to-many, and many-to-many. Exam: ONLY one-to-many relationship type; import three Excel files…

1:1 relationship in set notation

A one-to-one relationship A one-to-one relationship exists when one table has one record associated with only one record of another table (very rare using Microsoft Access). Previous PK as FK database…. Shipping Address table is an related table. Primary table: customer table

1:M relationship in set notation

M:N relationship in set notation (Not Possible using Access)

Importing External Access Table and Excel Worksheet Barbara also wants you to include the Product and Order Detail tables from the FineFood database in the Restaurant database. Download and Review design view of FineFood DB first

Importing External Access Table and Excel Worksheet (cont) And she wants you to include the Billing Address Excel worksheet as a Access table in the Restaurant database. Before try to import the excel file, review it first Use Excel column headings for Access table PK: CustomerNum Specify in the description area of Design View that CutomerNum is not only primary key of BillingAddress table but also a foreign key of Customer table.

Enforcing referential integrity Referential integrity allows you to maintain the integrity and consistency between related tables. If you choose to enforce referential integrity, you can insure that you will not have records that have no matching record in the primary table. That is, when updating or deleting a record (PK) in the primary table, a matching record (FK) in the related record must be updated or deleted.

Use cascade update and cascade delete In Access referential integrity, there are two options. If you choose cascaded updates, making a change in a field that is common to two related tables will cause the update to be made in both tables. If you delete a field that is common to two tables, the deletion will take place in both tables. Try Referential Integrity Example DB on the class web page.

Selecting the tables for a relationship When all tables are added, click the Close button. To define a relationship, open the Show Table dialog box by clicking the Relationship button on the toolbar. Select each table you want to be in the relationship and click the Add button.

Setting relationship options The Edit Relationships dialog box is where you can determine the type of relationship, and set referential integrity and cascade update/delete options.

The Relationships window You can see the tables, fields, and relationship types for any relationship in the Relationship window. The lines indicate the common fields involved in each relationship. The symbols indicate the type of relationship. The Employer table has two one- to-many relationships--one with the Positions table, and one with the NAICS table.

Creating Relationship Download Restaurant2 file from the class web Create relationships using 5 table In terms of creating a relationship between Customer and BillingAddress, start from the Customer table. Enforce both cascade options Primary key of the Order Detail table Combination of OrderNum and ProductCode Otherwise, a duplication of the quantity field in both the Order and Product tables.

Relationship Assignment: Creating Relationship Create a blank database (use any names you like) And then, import the three Excel Worksheets (Course, Instructor, and Membership) from the class web site into your Access database. Define each imported tables primary key using information below: Course table: Class_Number Instructor table: Employee_Number Membership table: Member_Number

Relationship Assignment: Creating Relationship Establish relationship based on common fields. And enforce referential integrity (apply both options) among three imported tables