Introduction to MS Access: creating tables, keys, and relationships

Similar documents
A hypothetical M:M student schedule example

BSAD 141, Fall 2017 In-class ERD exercise (Tuesday, 10/24)

FIT1004 Database Topic 6: Normalisation

Data, Information, and Databases

Page 1 of 7. First tutorial: Second tutorial:

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

King Fahd University of Petroleum and Minerals

Entity Relationship Diagrams and Relational DBs

CSE 530A. ER Model to Relational Schema. Washington University Fall 2013

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Data Management Lecture Outline 2 Part 2. Instructor: Trevor Nadeau

Consistency The DBMS must ensure the database will always be in a consistent state. Whenever data is modified, the database will change from one

Relational Data Model. Christopher Simpkins

SQL Server 2008 Tutorial 3: Database Creation

Database Management Systems

Data about data is database Select correct option: True False Partially True None of the Above

Database Management Systems

CS317 File and Database Systems

EE221 Databases Practicals Manual

Lecture 18. Business Intelligence and Data Warehousing. 1:M Normalization. M:M Normalization 11/1/2017. Topics Covered

DATABASE DEVELOPMENT (H4)

Introduction to Databases

Databases. Purpose Of A Database. To store information

Discussion Focus. Figure 1

ER Modeling ER Diagram ID-Dependent and Weak Entities Pg 1

Database Logical Design

Entity Relationship Diagram (ERD) Dr. Moustafa Elazhary

Relational Database Components

Introduction to Databases

Database Foundations. 5-1 Mapping Entities and Attributes. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

COMM 391. Objectives. Introduction to Microsoft Access. What is in an Access database file? Introduction to Microsoft Access 2010

Normalization in Databases

CHAPTER 6 SUMMARY. Objective 1: Identify Good Database Design

1.264 Lecture 7. Introduction to SQL

Database Systems Relational Model. A.R. Hurson 323 CS Building

CS2300: File Structures and Introduction to Database Systems

Avancier Methods (AM) From logical model to physical database

Database Logical Design

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

Logical Database Design. ICT285 Databases: Topic 06

The Relational Model Constraints and SQL DDL

Database Design and Administration for OnBase WorkView Solutions. Mike Martel Senior Project Manager

CMP-3440 Database Systems

Outer Join, More on SQL Constraints

COVENTRY UNIVERSITY. A.L.L. Project 3. Database Project. Jordan Bignell, Robert Bowry, Muhammed Abba Ismail, Emmanuel Idowu.

Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50)

SUMMER EXAMINATIONS 2013

Advanced SQL GROUP BY Clause and Aggregate Functions Pg 1

Relational model. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)

Relational terminology. Databases - Sets & Relations. Sets. Membership

22/01/2018. Data Management. Data Entities, Attributes, and Items. Data Entities, Attributes, and Items. ACS-1803 Introduction to Information Systems

Introduction to Computer Applications. CISY 1225 Chapter 10. Zahoor Khan, PhD

ACS-1803 Introduction to Information Systems. Instructor: Kerry Augustine. Data Management. Lecture Outline 2, Part 2

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

Introduction to Relational Database Concepts. Copyright 2011, Oracle. All rights reserved.

Home Page. Title Page. Page 1 of 14. Go Back. Full Screen. Close. Quit

Teaching Scheme BIT/MMC/BCS Database Systems 1

To build students capabilities on data modeling

Northern India Engineering College, New Delhi Question Bank Database Management System. B. Tech. Mechanical & Automation Engineering V Semester

What is Data? ANSI definition: Volatile vs. persistent data. Data. Our concern is primarily with persistent data

What is Data? Volatile vs. persistent data Our concern is primarily with persistent data

Babu Madhav Institute of Information Technology 2015

Data, Databases, and DBMSs

namib I A U n IVERS I TY

Introduction to Database Management Systems

Introductory SQL SQL Joins: Viewing Relationships Pg 1

1D D0-541 CIW v5 Database Design Specialist Version 1.7

The Relational Model

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

In This Lecture. The Relational Model. The Relational Model. Relational Data Structure. Unnamed and named tuples. New thing:scheme (and attributes)

Sankalchand Patel College of Engineering, Visnagar B.E. Semester III (CE/IT) Database Management System Question Bank / Assignment

Access Tutorial 2 Building a Database and Defining Table Relationships

Relational Databases Overview

Overview of Data Management

SECTION 1 DBMS LAB 1.0 INTRODUCTION 1.1 OBJECTIVES 1.2 INTRODUCTION TO MS-ACCESS. Structure Page No.

3.1. Keys: Super Key, Candidate Key, Primary Key, Alternate Key, Foreign Key

KASBO Fall 2014 Session 4T Excel for Munis Payroll (Lab) Presenter: Sheila Miller, KDE Business Analyst

Entity Attribute STUDENT TABLE tuples single domain

پوهنتون کابل پوهنحی كمپيوترساینس پوهنیار محمد شعیب "زرین خیل"

VS2010 C# Programming - DB intro 1

Accounting Information Systems, 2e (Kay/Ovlia) Chapter 2 Accounting Databases. Objective 1

Database Systems ( 資料庫系統 )

Distributed Database Systems By Syed Bakhtawar Shah Abid Lecturer in Computer Science

ER to Relational Model. Professor Jessica Lin

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute

Learning Unit 1 CHECK POINT 1 CHECK POINT 2

In mathematical terms, the relation itself can be expressed simply in terms of the attributes it contains:

SUMMER EXAMINATIONS 2014

SQL DATA DEFINITION: KEY CONSTRAINTS. CS121: Relational Databases Fall 2017 Lecture 7

Lecture 01. Fall 2018 Borough of Manhattan Community College

GlobAl EDITION. Database Concepts SEVENTH EDITION. David M. Kroenke David J. Auer

Handout 6 CS-605 Spring 18 Page 1 of 7. Handout 6. Physical Database Modeling

LAB 2 Notes. Conceptual Design ER. Logical DB Design (relational) Schema Refinement. Physical DD

Wentworth Institute of Technology COMP570 Database Applications Fall 2014 Derbinsky. Physical Tuning. Lecture 10. Physical Tuning

MIS 2502 Access 2007 Tutorial

MS Access Let s begin by looking at the toolbar and menu of Access.

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved.

Assignment Grading Rubric

Information Systems Development COMM005 (CSM03) Autumn Semester 2009

Transcription:

Introduction to MS Access: creating tables, keys, and relationships BSAD 141 Dave Novak Topics Covered Brief introduction to MS Access Name and save a DB file Create tables and keys Create and enforce relationships Convert a partial ERD to design in Access Examples of both entity integrity and referential integrity using Access Example Important to note! If you are having trouble keeping up with the lecture or having some type of technical problems, you may need to read through the book and notes and work through the examples These will walk you through the basic features in MS Access and guide you through table and key creation as well as how to create relationships between tables Example: Partial ERD Consider a relationship between a manager and a project Assume the following: Each manager can manage up to 5 different projects simultaneously Each manager must manage at least one project Each project is assigned to only 1 manager (there are no co-manager leads on the project) When entered into the DBMS, each project must be assigned to a manager Example: Partial ERD Draw the partial ERD discuss degree, connectivity, and existence Two Types of RDBMS Integrity Rules 1) Entity Integrity Guarantees each entity (where each row in a table represents a unique entity) has a valid and unique PK (no missing or repeat values) 2) Referential Integrity All FK values (on the many side of the relationship) must first exist in the parent table (values must be first be entered conform to entity integrity on the one side of the relationship) 1

Two Types of RDBMS Integrity Rules In practice this means that once you have established the correct relationships between the tables in relational DB, enter the data for all tables on the ONE side of the relationship before entering any data for any table on the MANY side of the relationship Building Tables in Access Create a DB file called class-example1 Build 2 separate tables that correspond to the partial ERD you just drew Attributes for (ID, FirstName, LastName, Address, Salary) Attributes for Project (ProjectID, ProjectName, Duration, Phase) Model the relationship in Access and enforce referential integrity Building Tables in Access 1) Create the shell or empty tables to begin with 2) Specify the data type for each attribute (ID (txt), FirstName (txt), LastName (txt), Address (txt), Salary (currency)) Project (ProjectID (txt), ProjectName (txt), Duration (txt), Phase(txt)) Link the tables using a Foreign Key Using our ERD and what you know about the location of Foreign Keys FK: Which table does the FK appear in? What is the FK attribute? Go into design view and add the FK attribute Enter Data in Table: Entity Integrity Error Complete Table ID FirstName LastName Address Salary Mary Wells 1 North St. $78,000 ID FirstName LastName Address Salary 123-76-8823 Mary Wells 1 North St. $78,000 Just use 5 attributes and enter 3 records I give you You get an error message if you violate entity integrity rules 2

Enter Data in Project Table Project ProjectID ProjectName Duration Phase Populate the FK attribute: Referential Integrity Error Project PRJ-145 Health Care Database 14 months 2 PRJ-147 Traveler's Insurance Payroll System 26 months 1 PRJ-151 Capital Finance Highway 41 7 months 1 PRJ-187 Economic Analysis UVM Expansion 9 months 3 Just use the 4 attributes and enter the 4 records I give you! ProjectID ProjectName Duration Phase ID PRJ-145 Health Care Database 14 months 2 756-98-2222 Traveler's Insurance Payroll PRJ-147 System 26 months 1 756-98-2222 PRJ-151 Capital Finance Highway 41 7 months 1 123-76-8823 Economic Analysis UVM PRJ-187 Expansion 9 months 3 654-98-0033 We will end up with a referential integrity violation Referential Integrity One of the FK attribute values in the Project Table (the M side of the relationship) does not exist in the parent table (the Table the one side of the relationship). There is NO manager ID 654-98-0033, so that ID value cannot be assigned to a project ID? ID FirstName LastName Address Salary Referential Integrity and Tables The specific value you enter for any FK attribute value must FIRST exist in the parent table Example: I cannot be assigned to teach a section of 141 (or any other class) if I am not first listed in the professor / teacher table You have a value for ID that exists in the table 123-76-8823 Mary Wells 1 North St. $78,000 A systematic process to control / reduce redundancy and improve integrity in a RDB that involves organize all data into tables and columns Minimize duplicate data Minimize or avoid data modification issues Simplify queries Typically a trade-off between higher levels of normalization and processing speed As redundancy is reduced, the time it takes the DBMS to process a query or extract data can increase Higher levels of normalization may not always be desired where processing speed is critical 3

Hrs Proj Proj# ProjName ProjStartDate Emp# EmpName EmpAddress JobClass HrBillRate Worked 15 UVM DB Design 10/15/2009 12 John Jones 14 Green St. Elect. Eng. 85 30 15 UVM DB Design 10/15/2009 34 Sally Smith 14 Green St. DB Designer 100 20 Y 15 UVM DB Design 10/15/2009 22 Homer Simpson 34 Blue Ave. Sys Analyst 50 40 21 Health Care Evaluation 7/1/2009 12 J. Jones 14 Green St. Elect. Eng. 85 15 Y 21 Health Care Evaluation 7/1/2009 35 Jill Wilson 876 Lake Rd. Programmer 60 45 21 Health Care Evaluation 7/1/2009 34 Sally Smith 14 Green St. DSS Analyst 70 40 21 Health Care Evaluation 7/1/2009 22 Homer Simpson 34 Blue Ave. DB Designer 90 15 30 Roadway B/C 9/15/2010 34 Sally Smith 14 Green St. Economist 75 50 Y 30 Roadway B/C 9/15/2010 35 Jill Wilson 876 Lake Rd. Programmer 60 75 We want to convert this single table DB file to a relational DBMS format There are clearly some redundancy issues with the data How do we address redundancy via normalization and organize the data into relational tables? Step 1 The current format is just an Excel worksheet, not a relational DBMS Identify attributes of each entity (or fields to be placed in each table) Step 2 Create tables and columns (attributes) needed to capture all data in a relational format Attributes and data related to a specific entity in one table and attributes and data related to another entity in a different table Design tables to minimize need to enter redundant information What do we do with attributes that pertain to both employee and project? Step 3 Consider relationship connectivity (1:M, M:M) may be a trial and error process What type of relationship best captures the data relationships we have here? Can employees work on more than 1 project at a time, or only 1 project at a time? Is each project staffed by only 1 employee, or can each project be staffed my multiple employees? We can tell by looking at the data in the Excel table Step 4 Draw the partial ERD 4

Summary Introduction to MS Access Name and save a DB file Create tables and keys Create and enforce relationships Convert a partial ERD to design in Access Examples of both entity integrity and referential integrity using Access Example 5