IE 423 – Design of Decision Support Systems Database development – Relationships and Queries.

Slides:



Advertisements
Similar presentations
Database Relationships in Access As you recall, the data in a database is stored in tables. In a relational database like Access, you can have multiple.
Advertisements

The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
Build a database I: Design tables for a new Access database
Table Relationships RDBM. Prof. Leighton2 Establishing Table Relationships RDBMS allow us to establish relationships among tables Have a primary key in.
UNIVERSITY OF PALESTINE business computer application College of Business Instructor: Mr. Ahmed Abumosameh.
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.
Data Design The futureERD - CardinalityCODINGRelationshipsDefinition.
Introduction to MS Access, building tables, creating keys, creating relationships BSAD 141 Dave Novak.
ISP 121 Access Normalization and Relationships. Normalization Say we’re operating a pet day-care and we need to keep information on our pets/customers.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
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.
SQL Keys and Constraints Justin Maksim. Key Declaration Key constraint defined within the CREATE TABLE command Key can be declared using either the PRIMARY.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Computer Science & Engineering 2111 Introduction to Database Management Systems Relationships and Database Creation 1 CSE 2111 Introduction to Database.
Database Relationships Objective 5.01 Understand database tables used in business.
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.
Page 1 ISMT E-120 Introduction to Microsoft Access & Relational Databases The Influence of Software and Hardware Technologies on Business Productivity.
Microsoft ® Office Access ® 2007 Training Build a database III: Build relationships for a new Access database ICT Staff Development presents:
Database Relationships Objective 5.01 Understand database tables used in business.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
CS&E 1111 AcInnerJoins Inner Joins Objectives: Creating Queries with data from Multiple Tables Joining two tables using an Inner Join Referential Data.
Relational Database Concepts. Let’s start with a simple example of a database application Assume that you want to keep track of your clients’ names, addresses,
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
IE 423 – Design of Decision Support Systems Introduction to Data Base Management Systems and MS Access.
Microsoft ® Office Access ® 2007 Training Build a database I: Design tables for a new Access database ICT Staff Development presents:
CTFS Workshop Shameema Esufali Suzanne Lao Data coordinators and technical resources for the network
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
IE 423 – Design of Decision Support Systems Database development – Relationships and Queries.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
Access Chapter 2: Relational Database Objectives Design data Create tables Understand table relationships Understand data types, key, & field properties.
Database Design. Referential Integrity : data in a table that links to data in another table must always work in such a way that following the link will.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
Microsoft Access Intro Class 6 Relationships.
Using Microsoft Access 56:150 Information System Design.
Microsoft Access 2010 Crash Course Part 1 Academic Health Center Training (352)
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
26 Mar 04 1 Application Software Practical 5/6 MS Access.
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.
Microsoft Access 2010 Chapter 3 Maintaining a Database.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
1 The Information School of the University of Washington Dec 1fit advdatabases © 2006 University of Washington Advanced Database Concepts INFO/CSE.
Build a database III: Build relationships for a new Access database Overview: You can relate This course teaches you how to build relationships between.
DAY 9: DATABASES Rohit September 21,
1 MS Access. 2 Database – collection of related data Relational Database Management System (RDBMS) – software that uses related data stored in different.
Planning & Creating a Database By Ms. Naira Microsoft Access.
1 CHƯƠNG 4 Creating Relational Databases Understanding Table Relationships Example: This database tracks customers and their orders in two separate.
Referential Integrity
CTFS Workshop Shameema Esufali Asian data coordinator and technical resource for the network
D1 FMA Review. Many-to-Many Relationships - Examples Car Hire –A customer may hire one or more cars –A car may be hired by one or more customers Gym Club.
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
IE 423 – Design of Decision Support Systems Data modeling and database development.
NORMALIZATION: ‘1NF’ The general rule: ‘’Any field which can have many, must have its own table’’ By Sam Beaumont.
Howard Paul. Sequential Access Index Files and Data File Random Access.
1. Create a relationship diagram for the Employees database.
Database Relationships Objective 5.01 Understand database tables used in business.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Database Relationships
Tables & Relationships
CIS 155 Table Relationship
Database Relationships
Insert, Update, Delete Manipulating Data.
Relational Queries (query 12) Display vendor contact info (contact person and phone number) for inventory products (relationship query) Query: Inventory.
Database Relationships
Presentation transcript:

IE 423 – Design of Decision Support Systems Database development – Relationships and Queries

Table Design and Relationships NameRoo m PhoneArtistSong Bob Jimmy Buffet Brown Eyed GirlSon of a Son of a Sailor Margaritaville Sam SantanaDevil Woman Fred BeatlesDear PrudenceAbbey RoadHey Jude …………… Mary Sarah McLachlan SurfacingWinter SongAngel …………… Recall our music tracking system

Table Design and Relationships NameRoomPhoneArtistSong Bob Jimmy BuffetMargaritavill e Bob Jimmy BuffetBrown Eyed Girl Bob Jimmy BuffetSon of a Son of Sailor …………… Mary Sarah McLachlan Angel …………… Recall our music tracking system

Table Design and Relationships A relational database gets its power from the ability to manage multiple tables of data and the relationships among those tables MS Access is a relational database management system In designing and building a relational database you will define the tables (the fields and their properties, and The relationships among these tables

Splitting the previous table into two tables… IDNameRoomPhone 1Bob Mary ………… IDArtistSong 1Jimmy Buffet Margarita ville 1Jimmy Buffet Brown Eyed Girl 1Jimmy Buffet Son of a Son of Sailor ……… 2Sarah McLachlan Angle 2Rolling Stones …

Database Design Splitting the previous table into two tables… More efficient We don’t have to reenter the people information for every song If we find a song in the song table how do we find the owner in the people table  In a relation one table has a field that is unique (no other record can have the same value This field is called a Primary Key  A related table will have a field with matching value (as the primary field in the other table), … but it does not have to be unique – This is called a foreign key  In our example, ID is the foreign key in the people table

Splitting the previous table into two tables… IDNameRoomPhone 1Bob Mary ………… IDArtistSong 1Jimmy Buffet Margarita ville 1Jimmy Buffet Brown Eyed Girl 1Jimmy Buffet Son of a Son of Sailor ……… 2Sarah McLachlan Angle 2Rolling Stones …

So finding the owner of a particular song… We find a song in the music table, and get the ID value Go to the People table and find a record where the ID matches the one that we picking in the music table  music.id = people.id Once you have setup the database Access does all of this for you

Types of relationships in a relational database One to many – one record in table A matches (potentially) many records in table B One to one – one record in table A matches only one record in table B Many to many – records in table A can have multiple matching records in table B --- and vis- versa  This one is tricky  Consider an Orders table and a Products table

Referential Integrity (what?!) If a record in one table is linked (has a relationship) to one or more records in another table.. We must protect that link Referential Integrity – the assurance that this link does not get broken How could we violate referential integrity?  Delete a record on one side of the relation without first deleting linked records on the other side. If Bob moves we can’t delete his record from the people table without first deleting his songs from the music table  Add a record on the many side of the relation without the corresponding record existing on the one side of the relation We can’t add the new guy – Fernando’s songs to the music table unless Fernando’s information is in the people table

Database Development Let’s go back to our House Survey Data

Database Development Let’s go back to our House Survey Data

Neighbor08a.mdb

Remember that we split our House Survey data into two relations (tables) …so now we need to create a table for the rest of the data Don’t forget that each record must have a unique house identifier …and what we will use this for?

New tables for Neighbor08 database

Neighbor08a.mdb Make a relationship between these two tables How do you do this? What kind of relationship is this?

Neighbor08a.mdb Then, we are also interested in who lives in these houses… …so create another table for people You will need – PersonID HouseID –to tell which house they live in FirstName LastName DOB (what data type?) CellPhone (use an input mask)

Neighbor08a.mdb

Make a relationship between what two tables? How do you do this? What kind of relationship is this?

College.mdb Let’s look at another database Suppose you need to create a course registration system for college courses (or workshops, etc.) What are the objects that you need to work with? Students, Courses, ??? So, you have a table of students You have table of courses How do you relate these two tables? Does this present any problems?

College.mdb