SlideShare a Scribd company logo
3
Most read
7
Most read
8
Most read
Database Relationships Objective 5.01 Understand database tables used in business
Relationships A relationship means that two or more tables are linked together by a common field, called a primary key field. Table relationships increase the power of the database by allowing data to be stored separately, but managed and retrieved collectively.
Making Friends with Relations Slide  5.01 Understand database tables used in business Relationships  link data from individual tables and increase the usefulness of a database. One of the great benefits of working with databases is the ability to store huge quantities of information.  One company’s database may contain multiple tables of related information. When the information between tables is linked, it is called a relationship.
What does a relationship look like? One record in the Student Table is related to one record in the Participation Table Relationship established between two tables
Keys to the Relationship A primary key  is an essential element of a database table.  It is a data type that is set to make each record within a database table unique and to link tables together. Primary key fields   must be of the same data type and size  for the tables to which they link. The red line that graphically represents the relationship is called a  Join Line
What makes a good primary key? Which of the following would make each record in a database unique? Social security number Last name First name Automobile VIN number Birth date Product serial number
Primary and Foreign Keys When tables relate, the primary key of one table becomes a  foreign key  of the other table For example, in the tables below,  ISBN appears as a primary key in the Grocery Products table . . .…and in the Orders Table as a foreign key
Diagram of Primary & Foreign Keys 5.02 Understand queries, forms, and reports.
Function of the Junction Table A junction table is used to join primary key fields of multiple tables The Junction table is like a hub or control center In this example, Orders is the Junction Table.  It allows the Grocery Products and the Customers tables to share information.
One-to-Many One-to-Many One record in Table A links to multiple records in Table B through the primary/foreign key fields of the two tables
Many-to-Many Many-to-Many Multiple records in multiple tables are linked by their primary keys through a Junction Table.  A many-to-many relationship is formed by connecting two or more tables that have a one-to-many relationship.  The connection is made by a  Junction Table.
Setting up a Relationship Add one table’s primary key to a field in another table that has the same properties  The primary key in Grocery Products is ISBN The primary key in Orders is Order No The primary key in Customers is Store ID
Referential Integrity Referential integrity  protects related data that is stored in multiple tables.  It would prevent a customer in one table from being deleted if the customer is also in a related table.
Relationship Discussion A music store database contains three tables.  An Inventory table is linked by artist to a Royalty table which contains the artist’s contact information and royalty percentages The Inventory table is also linked to a Sales table by salesperson ID numbers, which contains employee information and commission rates Once a purchase is made, the inventory is adjusted in one table and the artist’s royalties and employee’s commissions are calculated from the information in the other tables What are the advantages of this system? Are there disadvantages?

More Related Content

PPTX
PPT on Photoshop
PPTX
RELATIONSHIP IN DBMS.pptx
PPT
MS-Access Tables Forms Queries Reports.ppt
PPT
Simple Linier Regression
ODP
Genetic algorithm ppt
PPTX
Garbage collection
PPT
Databases: Normalisation
PDF
Java Garbage Collection - How it works
PPT on Photoshop
RELATIONSHIP IN DBMS.pptx
MS-Access Tables Forms Queries Reports.ppt
Simple Linier Regression
Genetic algorithm ppt
Garbage collection
Databases: Normalisation
Java Garbage Collection - How it works

What's hot (20)

PPTX
Normal forms
PPT
MYSQL.ppt
PPTX
Structure of dbms
PPTX
joins in database
PPTX
SQL Functions
PPTX
Android Layout.pptx
PPTX
HTML: Tables and Forms
PPTX
Er diagrams presentation
PPTX
Sql Functions And Procedures
PPT
Sequences and indexes
PDF
Normalization in DBMS
PPTX
Transaction management DBMS
PPT
1. Introduction to DBMS
PPT
Database Relationships
PPT
Sql ppt
PDF
Dbms 3: 3 Schema Architecture
PPT
Dbms models
PPTX
The Relational Database Model
PPTX
Data structure & its types
PPTX
Acid properties
Normal forms
MYSQL.ppt
Structure of dbms
joins in database
SQL Functions
Android Layout.pptx
HTML: Tables and Forms
Er diagrams presentation
Sql Functions And Procedures
Sequences and indexes
Normalization in DBMS
Transaction management DBMS
1. Introduction to DBMS
Database Relationships
Sql ppt
Dbms 3: 3 Schema Architecture
Dbms models
The Relational Database Model
Data structure & its types
Acid properties
Ad

Viewers also liked (20)

PPTX
Relationships within the relational database
ODP
Creating relationships with tables
PPTX
Relational Database Design
PPT
3. Relational Models in DBMS
PPTX
Database : Relational Data Model
PDF
Relational Database Management System
PDF
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
PPT
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
PPT
Database Fundamentals
PDF
Sql ch 9 - data integrity
PPTX
integrity constraints
PPTX
Laravel for Web Artisans
PPT
ISDD Database Structure N5
PDF
Database & dbms
PPT
PPTX
Datatypes, Field Properties, Validation and Masking
PPTX
Integrity Constraints
PPTX
Slide 6 er strong & weak entity
PPT
Data Dictionary
PPT
Database Validation
Relationships within the relational database
Creating relationships with tables
Relational Database Design
3. Relational Models in DBMS
Database : Relational Data Model
Relational Database Management System
Relational Database Design - Lecture 4 - Introduction to Databases (1007156ANR)
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
Database Fundamentals
Sql ch 9 - data integrity
integrity constraints
Laravel for Web Artisans
ISDD Database Structure N5
Database & dbms
Datatypes, Field Properties, Validation and Masking
Integrity Constraints
Slide 6 er strong & weak entity
Data Dictionary
Database Validation
Ad

Similar to Database Relationships (20)

PPT
Database Relationships
PPTX
Database Concepts and Terminologies
PPT
MS-Access Database Creation and Management
PPT
ms access tutorial regarding database management and training 2222
PPT
Ms Access: Database creation and Management.ppt
PDF
Create a table access - office
PPTX
Database.pptx
PPT
ChoiAccess.ppt
PPT
ChoiAccess.pptbuhuhujhhuhuhuhuhuhhhhhhhhhhhhh
PPT
Microsoft Access ppt.ppt
PPT
Presentation on Microsoft Access Database creation and management
PPTX
Create table relationships
PPTX
Create table relationships
PPTX
Lesson Five Building Table Relationships
PPT
Access07 l1 ch2
PPTX
Key,ID Field and Tables Relationship
Database Relationships
Database Concepts and Terminologies
MS-Access Database Creation and Management
ms access tutorial regarding database management and training 2222
Ms Access: Database creation and Management.ppt
Create a table access - office
Database.pptx
ChoiAccess.ppt
ChoiAccess.pptbuhuhujhhuhuhuhuhuhhhhhhhhhhhhh
Microsoft Access ppt.ppt
Presentation on Microsoft Access Database creation and management
Create table relationships
Create table relationships
Lesson Five Building Table Relationships
Access07 l1 ch2
Key,ID Field and Tables Relationship

More from wmassie (20)

PDF
Microsoft word 2.01 notes a
DOC
L:\Principles Of Business Notes\2 01 Notes
PDF
Document Examples
PDF
Document examples
PDF
Document Examples
PDF
Document Examples
PPT
The target-audience
PPT
Publications
PPT
Design principles
DOC
3.02 student activity
DOC
Business publications 3.02 notes
DOC
1 01 Notes Internet Search Tools T
DOC
Modify Subforms
PPT
Reports
PPT
Forms And Subforms
PPT
Queries
PPT
Forms
DOC
5.02 Notes Student
DOC
5.01 Activity Notes A
PPT
Data Types And Field Properties
Microsoft word 2.01 notes a
L:\Principles Of Business Notes\2 01 Notes
Document Examples
Document examples
Document Examples
Document Examples
The target-audience
Publications
Design principles
3.02 student activity
Business publications 3.02 notes
1 01 Notes Internet Search Tools T
Modify Subforms
Reports
Forms And Subforms
Queries
Forms
5.02 Notes Student
5.01 Activity Notes A
Data Types And Field Properties

Recently uploaded (20)

PPTX
The story of Nomuzi and the way she was living
PPTX
the-solar-system.pptxxxxxxxxxxxxxxxxxxxx
PPT
business model and some other things that
PPTX
PRECISION AGRICULTURE- 1.pptx for agriculture
PPTX
Safety_Pharmacology_Tier2_Edibbbbbbbbbbbbbbbable.pptx
PPTX
Hacking Movie – Best Films on Cybercrime & Digital Intrigue
PDF
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
PDF
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
PDF
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
PDF
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
DOC
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
PDF
oppenheimer and the story of the atomic bomb
PDF
High-Quality PDF Backlinking for Better Rankings
PPTX
Other Dance Forms - G10 MAPEH Reporting.pptx
PPTX
shbthd htsh htrw hw htr 5w h5e 54 y.pptx
PDF
WKA #29: "FALLING FOR CUPID" TRANSCRIPT.pdf
DOCX
Nina Volyanska Controversy in Fishtank Live_ Unraveling the Mystery Behind th...
PPTX
the Honda_ASIMO_Presentation_Updated.pptx
PPTX
What Makes an Entertainment App Addictive?
PDF
EVs U-5 ONE SHOT Notes_c49f9e68-5eac-4201-bf86-b314ef5930ba.pdf
The story of Nomuzi and the way she was living
the-solar-system.pptxxxxxxxxxxxxxxxxxxxx
business model and some other things that
PRECISION AGRICULTURE- 1.pptx for agriculture
Safety_Pharmacology_Tier2_Edibbbbbbbbbbbbbbbable.pptx
Hacking Movie – Best Films on Cybercrime & Digital Intrigue
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
MAGNET STORY- Coaster Sequence (Rough Version 2).pdf
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
oppenheimer and the story of the atomic bomb
High-Quality PDF Backlinking for Better Rankings
Other Dance Forms - G10 MAPEH Reporting.pptx
shbthd htsh htrw hw htr 5w h5e 54 y.pptx
WKA #29: "FALLING FOR CUPID" TRANSCRIPT.pdf
Nina Volyanska Controversy in Fishtank Live_ Unraveling the Mystery Behind th...
the Honda_ASIMO_Presentation_Updated.pptx
What Makes an Entertainment App Addictive?
EVs U-5 ONE SHOT Notes_c49f9e68-5eac-4201-bf86-b314ef5930ba.pdf

Database Relationships

  • 1. Database Relationships Objective 5.01 Understand database tables used in business
  • 2. Relationships A relationship means that two or more tables are linked together by a common field, called a primary key field. Table relationships increase the power of the database by allowing data to be stored separately, but managed and retrieved collectively.
  • 3. Making Friends with Relations Slide 5.01 Understand database tables used in business Relationships link data from individual tables and increase the usefulness of a database. One of the great benefits of working with databases is the ability to store huge quantities of information. One company’s database may contain multiple tables of related information. When the information between tables is linked, it is called a relationship.
  • 4. What does a relationship look like? One record in the Student Table is related to one record in the Participation Table Relationship established between two tables
  • 5. Keys to the Relationship A primary key is an essential element of a database table. It is a data type that is set to make each record within a database table unique and to link tables together. Primary key fields must be of the same data type and size for the tables to which they link. The red line that graphically represents the relationship is called a Join Line
  • 6. What makes a good primary key? Which of the following would make each record in a database unique? Social security number Last name First name Automobile VIN number Birth date Product serial number
  • 7. Primary and Foreign Keys When tables relate, the primary key of one table becomes a foreign key of the other table For example, in the tables below, ISBN appears as a primary key in the Grocery Products table . . .…and in the Orders Table as a foreign key
  • 8. Diagram of Primary & Foreign Keys 5.02 Understand queries, forms, and reports.
  • 9. Function of the Junction Table A junction table is used to join primary key fields of multiple tables The Junction table is like a hub or control center In this example, Orders is the Junction Table. It allows the Grocery Products and the Customers tables to share information.
  • 10. One-to-Many One-to-Many One record in Table A links to multiple records in Table B through the primary/foreign key fields of the two tables
  • 11. Many-to-Many Many-to-Many Multiple records in multiple tables are linked by their primary keys through a Junction Table. A many-to-many relationship is formed by connecting two or more tables that have a one-to-many relationship. The connection is made by a Junction Table.
  • 12. Setting up a Relationship Add one table’s primary key to a field in another table that has the same properties The primary key in Grocery Products is ISBN The primary key in Orders is Order No The primary key in Customers is Store ID
  • 13. Referential Integrity Referential integrity protects related data that is stored in multiple tables. It would prevent a customer in one table from being deleted if the customer is also in a related table.
  • 14. Relationship Discussion A music store database contains three tables. An Inventory table is linked by artist to a Royalty table which contains the artist’s contact information and royalty percentages The Inventory table is also linked to a Sales table by salesperson ID numbers, which contains employee information and commission rates Once a purchase is made, the inventory is adjusted in one table and the artist’s royalties and employee’s commissions are calculated from the information in the other tables What are the advantages of this system? Are there disadvantages?

Editor's Notes

  • #2: 5.01 Database Relationships
  • #3: 5.01 Database Relationships
  • #4: 5.01 Database Relationships Since the database information is associated, the database can pull all the information together whenever you want in ways that you specify. Examples of separate types of data (paragraph 1) In the recycling club database, member contact information is stored separately from lists of recycling volunteers or holiday planning data. Example of associated data (paragraph 2) Recycling club member Nancy Davolio’s name is associated with, or “knows about,” Nancy Davolio’s contact information, which is stored in another set of data. Creating a relational database means you can quickly pull information together. For example, you can quickly print a list of who's volunteered to recycle newspapers this Saturday, along with their up-to-date addresses and phone numbers.
  • #5: 5.01 Database Relationships
  • #6: 5.01 Database Relationships
  • #7: 5.01 Database Relationships Discuss why Last name and first name are not valid primary key fields.
  • #8: 5.01 Database Relationships A detailed example of how primary keys and foreign keys work Let’s say you have a Grocery Products table and an Orders table. The ISBN number is the primary key for the Grocery Products table and a foreign key for the Orders table. The Orders table has its own primary key, the Order ID number. When Nancy Davolio takes an order, her Employee ID number is entered into the Orders table. This ID number refers to the details about Nancy in the Employees table, so there's no need to repeat data about Nancy (such as her phone extension) in the Orders table. We’ll go into more detail about primary keys, foreign keys, and table relationships later in the presentation.
  • #9: The primary key of the Grocery Products table (ISBN) is linked to the foreign key of the Purchase Orders table (ISBN). The primary key of the Purchase Orders table (Order No.) is linked to the primary key of the Orders table. The foreign key of the Orders table (Store ID) is linked to the primary key of the Customers table.
  • #10: 5.01 Database Relationships
  • #11: 5.01 Database Relationships One-to-many example : A list of suppliers for the music store is contained in Table A. It is linked by the supplier ID field to Table B which contains all of the products used by the music store. When Table B is searched for a specific product (record), such as a CD carrying case, the manager can view the supplier’s contact information, which is stored in Table A. Many-to-Many example : In the music store database, Table A contains customer information and Table B contains CD inventory. A record for Bob from Table A may be linked to several records of CDs in Table B by linking the Customer ID fields. If Table B contains the CD inventory, a record for a particular CD can be linked to several customers in Table A.
  • #12: 5.01 Database Relationships One-to-many example : A list of suppliers for the music store is contained in Table A. It is linked by the supplier ID field to Table B which contains all of the products used by the music store. When Table B is searched for a specific product (record), such as a CD carrying case, the manager can view the supplier’s contact information, which is stored in Table A. Many-to-Many example : In the music store database, Table A contains customer information and Table B contains CD inventory. A record for Bob from Table A may be linked to several records of CDs in Table B by linking the Customer ID fields. If Table B contains the CD inventory, a record for a particular CD can be linked to several customers in Table A.
  • #13: 5.01 Database Relationships
  • #14: 5.01 Database Relationships
  • #15: 5.01 Database Relationships