Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Data.

Slides:



Advertisements
Similar presentations
Database Fundamentals
Advertisements

Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Physical.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Self-joins,
Microsoft Enterprise Consortium Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Database Fundamentals Defining.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Create Student-Team.
Chapter 3 Data Modeling Copyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Aggregate.
Data Design The futureERD - CardinalityCODINGRelationshipsDefinition.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals The Data.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Data.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Evaluating.
Microsoft Access 2003 Introduction To Microsoft Access 2003.
From Class Diagrams to Databases. So far we have considered “objects” Objects have attributes Objects have operations Attributes are the things you record.
DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Greenhouse Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 1 1 Microsoft Access 2003 Tutorial 1 – Introduction To Microsoft Access 2003.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Type II (Correlated)
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Introduction.
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 Relationships Objective 5.01 Understand database tables used in business.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Using two.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SQL Server.
Database Design Concepts
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
CTFS Workshop Shameema Esufali Suzanne Lao Data coordinators and technical resources for the network
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Test.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SELECT … FROM.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Nested aggregate.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Aggregating.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
Relational Database. Database Management System (DBMS)
One Customer has Many Pets; One Pet as One Customer, so Customer ID goes on Pet Table. One Pet has many Visits, but only one Visit refers.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SELECT … FROM.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Physical.
1 Database & DBMS The data that goes into transaction processing systems (TPS), also goes to a database to be stored and processed later by decision support.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Sorting output.
M1G Introduction to Database Development 4. Improving the database design.
Btec National - Advanced Databases 1 Advanced Databases Entity Relationship Diagrams.
Jozef Kuper.  Describe a Database  Entities  Atributes  Relationships.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Logical operators.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL In-Line Subquery.
Relational Theory and Design
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Equi-Join One-sided.
Lesson 2: Designing a Database and Creating Tables.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Set Operators:
CTFS Workshop Shameema Esufali Asian data coordinator and technical resource for the network
A table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows.
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals WHERE clause.
Btec National - IT SYSTEMS ANALYSIS AND DESIGN 1 IT Systems Analysis and Design Entity Relationship Diagrams.
Exploring Microsoft Access Chapter 5 One-to-Many Relationships: Subforms and Multiple Table Queries.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL The relational.
Databases A database is a collection of data. How that data is organized determines what type of database it is. Over the history of computers there have.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Revised: 2 April 2004 Fred Swartz
CSCI-100 Introduction to Computing
Order Database – ER Diagram
Database Fundamentals
Presentation transcript:

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Data Model: Physical Design – Part 2 Primary & Foreign Keys 1 Microsoft Enterprise Consortium

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium What you should already know … You should know relational data model terminology. You should know the database terms that correspond to the data model terms. ◦For example: attribute = column/field In the previous presentation, we started implementing a physical data model in a relational database. This presentation begins with how to implement the relationship between two entities. 2

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database “relationships” How do we put a “relationship” between the CUSTOMER and REPAIR ORDER tables in the database? We put the primary key from one table into the related table. Which primary key goes into the other table? 3 CUSTOMERREPAIR ORDER

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Foreign key Foreign key: A foreign key is a field in one table that corresponds to a primary key field in another table. We know which primary key to put in a related table because of the “one” side and the “many” side of the relationship. The rule: In a one-to-many relationship the “many” side gets the foreign key. 4 CUSTOMERREPAIR ORDER One-to-many The REPAIR ORDER table gets the foreign key column.

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Foreign key: Building a relationship The primary key field from CUSTOMER, which is CUST_ID, has a corresponding column in the related REPAIR ORDER table. The foreign key field, called CUSTID column in the example shown here, holds data that links to related data in the CUSTOMER table. 5 CUSTOMERREPAIR ORDER For repair order #1 (Ord_ID), the #4 in the CustID field, tells us that this work was done for Debbie Davies.

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Data redundancy Using the foreign key field to link related data is an essential element of relational database. It reduces data redundancy. Each relational database table stores data about a particular entity (a person, place, thing, or event). In the example below, there are 3 repair orders for Debbie Davies. However, we don’t store her information (name, address, etc.) more than once. The foreign key value #4 links Debbie Davies’ information to each of her repair orders. 6

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Foreign key field name The foreign key field name can match the related primary key field name exactly. This is often done. However, as shown in the example here, it is not required that the names match. In fact, in one situation, which you’ll see later, the names cannot match. It is required that the foreign key column be defined so that it contains the same data as in the related primary key column. The foreign key column is the same data type and field size as the primary key column. 7

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium This presentation covered … A relationship in the data model becomes the link between a primary key column in one table and its related foreign key column in another table. Storing data in separate tables, such as data about customer stored in CUSTOMER and repair work data in REPAIR ORDER, reduces data redundancy. 8

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Resources Microsoft Enterprise Consortium: Microsoft Faculty Connection—Faculty Resource Center 9