SlideShare a Scribd company logo
1 of 14
Download to read offline
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1



                            Systems Analysis and Design
                             Learning Module Series #2
                                 Document version

Creating an Intersection Table in a Relational Database
Overview
In this tutorial we will add two additional tables to the COURSE DATABASE that we created in “Systems
Analysis and Design, Learning Module Series #1, Creating a Relational Database.”

The first new table (the Student table) will contain a list of students who are taking some of the sections
associated with courses in our original database. Our goal is to be able to store (and accurately query) the
attribute “final_grade”, which is a functional dependency of Student and Section together:

      { (student, section)  final_grade }

Since a given student may be taking many sections; while a given section may be associated with many
students, there is no unambiguous way of identifying which set of records in one table belongs to a single record
in the other. It comes out that neither table can effectively contain the attribute final_grade.




As a result, the relational model does not support the direct implementation of many-to-many relationships and
the only solution is to break the many-to-many relationship into a pair of binary, one-to-many relationships.
This is achieved by introducing a third table to the pattern. These “third” tables have various names, but are
most commonly referred to as either “intersection”, “composite”, or “cross-reference” tables.




                                                         1
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




The new intersection table (the Registration table) then, will be utilized to eliminate the many-to-many
relationship that exists between students and sections. The Primary Keys of the Student and Section tables,
respectively, are both placed into the intersection table as a Foreign Key, such that the Primary Key of the
intersection table is a composite of the two Foreign Keys. Additionally, it will contain the attribute final_grade.



Creating the Student Table
   1. Open the Course Database (you created in Tutorial I) in MS Access 2007. From the Table Tools
      palette, select the Create tab, and click on Table.




   2. Under the All Tables pane, right click on Table1 : Table and select Design View from the drop down
      menu . (In the Save As dialog box, under Table Name, type Student and click OK .




                                                         2
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1



                                                                          




3. (a) Under the Student tab, under Field Name, enter Field (or column) names as follows: student_ID
   (primary key), last_name, first_name, address, city, state, zip and ssn.

   (b) Under Section tab, under Data Type, click the down-arrow for the student_ID to select Text.




4. When you are done, right-click on the Student tab and click Save on the drop down menu.




5. Under All Tables, double-click on Student : Table. Enter the data as shown below.




                                                 3
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




 6. When you are done, right-click on the Student tab and click Save on the drop down menu




 7. Right-click again and select Close All …    and Yes to “save changes to the layout of table Student”.




Creating the Registration (intersection) Table

 8. From the Table Tools palette, select the Create tab, and click on Table.




                                                    4
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




9. Under the All Tables pane, right click on Table1 : Table and select Design View from the drop down
   menu . (In the Save As dialog box, under Table Name, type Registration and click OK .

                                                                  




10. (a) Under the Student tab, under Field Name, enter Field (or column) names as follows: student_ID,
    section_ID and final_grade.

   (b) Under Section tab, under Data Type, click the down-arrow for the student_ID to select Text.




11. Holding down the Ctrl key, click both of the blue boxes preceding the rows (highlighted here in red)
    for both student_ID and section_ID. Then click the Primary Key button on the Design palette.


                                                  5
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




12. Right-click on the Registration tab and select Save.




13. Enter the data for student_ID, section_ID and final_grade as shown below.




                                                   6
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




14. Right-click on the Registration tab and select Save from the drop down menu.




15. Right-click again on the Registration tab and select Close All from the drop down menu.




                                                  7
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




Creating relationships between the tables
 16. From the Database Tools palette, click on the Relationships button.




 17. Under the All Tables pane, click on the Section : Table to highlight it and then drag and drop it over
     onto the Relationships view.




 18. Repeat this step for the Student : Table and the Registration : Table. Then re-arrange the tables so
     that the Registration (intersection) Table is located in the middle.




                                                    8
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




19. To join the tables together with referential integrity, first highlight section_ID in the Registration table
    (shown above), then drag this section_ID attribute to the left over to the Section table, dropping it on
    top of the section_ID attribute there. When the Edit Relationships dialog box appears, check all three
    check boxes: the Enforce Referential Integrity, Cascade Update Related Fields and Cascade
    Delete Related Records check boxes; and click the Create button.




20. Then, highlight student_ID in the Registration table (shown below), and drag this student_ID
    attribute to the right over to the Student table, dropping it on top of the student_ID attribute there.




21. When the Edit Relationships dialog box appears, check all three check boxes: the Enforce Referential
    Integrity, Cascade Update Related Fields and Cascade Delete Related Records check boxes; an
    click the Create button.

                                                      9
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




   You should now have successfully linked all three tables together, having created two binary one-to-
   many relationships constrained with referential integrity as shown below.




22. Right-click on the Relationships tab and click Save from the drop down menu.




                                                  10
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




 23. Right-click again on the Relationships tab and click Close All from the drop down menu.




Querying the database
 1. From the Create Palette, select Query Wizard.




 2.    At the New Query screen, accept the default Simple Query Wizard by clicking OK.



                                                   11
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




3. The Simple Query Wizard displays. Under Tables/Queries, click the drop down arrow to select the
   Table : Registration. Then transfer final_grade from Available Fields to Selected Fields by clicking
   the arrow show below in the red box




4. Under Tables/Queries, click the drop down arrow to select the Table : Student. Transfer last_name
   and first_name from Available Fields to Selected Fields by clicking the arrow as before.




                                                 12
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1




 5. Click the Finish button to see the results of the query below.




Conclusion

                                                    13
Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1


In this tutorial, we learned how to use an intersection table (the Registration table) to eliminate the many-
many relationship between student and sections, and effectively link the tables together accordingly with
referential integrity. We then successfully performed a query leveraging this implementation.




                           Systems Analysis and Design
                            Learning Module Series #2
                                Document version

Creating an Intersection Table in a Relational Database




                                                      14

More Related Content

What's hot

Excel Intermediate
Excel IntermediateExcel Intermediate
Excel Intermediatesimply_coool
 
Excel Graphs Charts
Excel Graphs ChartsExcel Graphs Charts
Excel Graphs Chartssimply_coool
 
PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |Umesh Kumar
 
Excel Intermediate 2007
Excel Intermediate 2007Excel Intermediate 2007
Excel Intermediate 2007simply_coool
 
Microsoft Access 2010 - a jargon free guide
Microsoft Access 2010 - a jargon free guideMicrosoft Access 2010 - a jargon free guide
Microsoft Access 2010 - a jargon free guidePaul Barnett
 
Excel Intro Part2 2007
Excel Intro Part2 2007Excel Intro Part2 2007
Excel Intro Part2 2007simply_coool
 
Microsoft Access 2007
Microsoft Access 2007Microsoft Access 2007
Microsoft Access 2007Reshma Arun
 
Access lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAccess lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAram SE
 
MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)Nad0209
 
Excel Printing Tips
Excel Printing TipsExcel Printing Tips
Excel Printing Tipssimply_coool
 
Access presentation
Access presentationAccess presentation
Access presentationDUSPviz
 
Access lesson05
Access lesson05Access lesson05
Access lesson05Aram SE
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAram SE
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAram SE
 

What's hot (20)

Excel Intermediate
Excel IntermediateExcel Intermediate
Excel Intermediate
 
MS Access 2010 tutorial 5
MS Access 2010 tutorial 5MS Access 2010 tutorial 5
MS Access 2010 tutorial 5
 
Excel Graphs Charts
Excel Graphs ChartsExcel Graphs Charts
Excel Graphs Charts
 
Access 2007
Access 2007Access 2007
Access 2007
 
Excel Intro Part2
Excel Intro Part2Excel Intro Part2
Excel Intro Part2
 
MS Access 2010 tutorial 3
MS Access 2010 tutorial 3MS Access 2010 tutorial 3
MS Access 2010 tutorial 3
 
PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |PPT On MS-Access 2007 | Full Concepts |
PPT On MS-Access 2007 | Full Concepts |
 
Excel Intermediate 2007
Excel Intermediate 2007Excel Intermediate 2007
Excel Intermediate 2007
 
Microsoft Access 2010 - a jargon free guide
Microsoft Access 2010 - a jargon free guideMicrosoft Access 2010 - a jargon free guide
Microsoft Access 2010 - a jargon free guide
 
Excel Intro Part2 2007
Excel Intro Part2 2007Excel Intro Part2 2007
Excel Intro Part2 2007
 
Microsoft Access 2007
Microsoft Access 2007Microsoft Access 2007
Microsoft Access 2007
 
Access lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access BasicsAccess lesson 01 Microsoft Access Basics
Access lesson 01 Microsoft Access Basics
 
MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)MICROSOFT ACCESS (ICTL)
MICROSOFT ACCESS (ICTL)
 
Excel Printing Tips
Excel Printing TipsExcel Printing Tips
Excel Printing Tips
 
Access presentation
Access presentationAccess presentation
Access presentation
 
Uses of MS Access in Business
Uses of MS Access in BusinessUses of MS Access in Business
Uses of MS Access in Business
 
Access lesson05
Access lesson05Access lesson05
Access lesson05
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying Forms
 
Excel Formatting
Excel FormattingExcel Formatting
Excel Formatting
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
 

Similar to S2 intersection table pdf

S6 advanced issues in erd pdf
S6 advanced issues in erd pdfS6 advanced issues in erd pdf
S6 advanced issues in erd pdfaviy1966
 
Creating relationships with tables
Creating relationships with tablesCreating relationships with tables
Creating relationships with tablesJhen Articona
 
S5 elementary erd pdf
S5 elementary erd pdfS5 elementary erd pdf
S5 elementary erd pdfaviy1966
 
MS Access and Database Fundamentals
MS Access and Database FundamentalsMS Access and Database Fundamentals
MS Access and Database FundamentalsAnanda Gupta
 
Acccesss notes
Acccesss notesAcccesss notes
Acccesss notesart02
 
Access Project IS312—Fall 2015 Last Updated 10092015 .docx
Access Project IS312—Fall 2015 Last Updated 10092015 .docxAccess Project IS312—Fall 2015 Last Updated 10092015 .docx
Access Project IS312—Fall 2015 Last Updated 10092015 .docxannetnash8266
 
SACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdfSACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdfPeputraHiring
 
Operate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptxOperate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptxEsubalew21
 
Practical 5
Practical 5Practical 5
Practical 5fizahPhd
 
Sorting, Filtering, and Creating Relationships.pptx
Sorting, Filtering, and Creating Relationships.pptxSorting, Filtering, and Creating Relationships.pptx
Sorting, Filtering, and Creating Relationships.pptxkulmiyealiabdille
 
ECDL module 5: using databases [To be continued]
ECDL module 5: using databases [To be continued] ECDL module 5: using databases [To be continued]
ECDL module 5: using databases [To be continued] Hassan Ayad
 
AccessProjectIS312—Fall2015Last Updated1009.docx
AccessProjectIS312—Fall2015Last Updated1009.docxAccessProjectIS312—Fall2015Last Updated1009.docx
AccessProjectIS312—Fall2015Last Updated1009.docxkeiran409es
 
Lesson Five Building Table Relationships
Lesson Five   Building Table RelationshipsLesson Five   Building Table Relationships
Lesson Five Building Table Relationshipsguevarra_2000
 
Working with Star Office CALC - R.D.Sivakumar
Working with Star Office CALC - R.D.SivakumarWorking with Star Office CALC - R.D.Sivakumar
Working with Star Office CALC - R.D.SivakumarSivakumar R D .
 
Module 08 Access & Use Database Application.pptx
Module 08 Access & Use Database Application.pptxModule 08 Access & Use Database Application.pptx
Module 08 Access & Use Database Application.pptxEsubalew21
 
Written by Dr. Preiser 1 CIS 3100 MS Access Assignment .docx
Written by Dr. Preiser 1 CIS 3100 MS Access Assignment  .docxWritten by Dr. Preiser 1 CIS 3100 MS Access Assignment  .docx
Written by Dr. Preiser 1 CIS 3100 MS Access Assignment .docxtroutmanboris
 
Intro to Microsoft Access
Intro to Microsoft AccessIntro to Microsoft Access
Intro to Microsoft AccessDUSPviz
 

Similar to S2 intersection table pdf (20)

S6 advanced issues in erd pdf
S6 advanced issues in erd pdfS6 advanced issues in erd pdf
S6 advanced issues in erd pdf
 
Creating relationships with tables
Creating relationships with tablesCreating relationships with tables
Creating relationships with tables
 
Database use
Database useDatabase use
Database use
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
S5 elementary erd pdf
S5 elementary erd pdfS5 elementary erd pdf
S5 elementary erd pdf
 
MS Access and Database Fundamentals
MS Access and Database FundamentalsMS Access and Database Fundamentals
MS Access and Database Fundamentals
 
Acccesss notes
Acccesss notesAcccesss notes
Acccesss notes
 
Access Project IS312—Fall 2015 Last Updated 10092015 .docx
Access Project IS312—Fall 2015 Last Updated 10092015 .docxAccess Project IS312—Fall 2015 Last Updated 10092015 .docx
Access Project IS312—Fall 2015 Last Updated 10092015 .docx
 
SACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdfSACRAO Presentation T4.3.pdf
SACRAO Presentation T4.3.pdf
 
Operate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptxOperate Spreadsheet applications ppt.pptx
Operate Spreadsheet applications ppt.pptx
 
Practical 5
Practical 5Practical 5
Practical 5
 
Sorting, Filtering, and Creating Relationships.pptx
Sorting, Filtering, and Creating Relationships.pptxSorting, Filtering, and Creating Relationships.pptx
Sorting, Filtering, and Creating Relationships.pptx
 
ECDL module 5: using databases [To be continued]
ECDL module 5: using databases [To be continued] ECDL module 5: using databases [To be continued]
ECDL module 5: using databases [To be continued]
 
AccessProjectIS312—Fall2015Last Updated1009.docx
AccessProjectIS312—Fall2015Last Updated1009.docxAccessProjectIS312—Fall2015Last Updated1009.docx
AccessProjectIS312—Fall2015Last Updated1009.docx
 
Lesson Five Building Table Relationships
Lesson Five   Building Table RelationshipsLesson Five   Building Table Relationships
Lesson Five Building Table Relationships
 
Working with Star Office CALC - R.D.Sivakumar
Working with Star Office CALC - R.D.SivakumarWorking with Star Office CALC - R.D.Sivakumar
Working with Star Office CALC - R.D.Sivakumar
 
Charts
ChartsCharts
Charts
 
Module 08 Access & Use Database Application.pptx
Module 08 Access & Use Database Application.pptxModule 08 Access & Use Database Application.pptx
Module 08 Access & Use Database Application.pptx
 
Written by Dr. Preiser 1 CIS 3100 MS Access Assignment .docx
Written by Dr. Preiser 1 CIS 3100 MS Access Assignment  .docxWritten by Dr. Preiser 1 CIS 3100 MS Access Assignment  .docx
Written by Dr. Preiser 1 CIS 3100 MS Access Assignment .docx
 
Intro to Microsoft Access
Intro to Microsoft AccessIntro to Microsoft Access
Intro to Microsoft Access
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Recently uploaded (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

S2 intersection table pdf

  • 1. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 Systems Analysis and Design Learning Module Series #2 Document version Creating an Intersection Table in a Relational Database Overview In this tutorial we will add two additional tables to the COURSE DATABASE that we created in “Systems Analysis and Design, Learning Module Series #1, Creating a Relational Database.” The first new table (the Student table) will contain a list of students who are taking some of the sections associated with courses in our original database. Our goal is to be able to store (and accurately query) the attribute “final_grade”, which is a functional dependency of Student and Section together: { (student, section)  final_grade } Since a given student may be taking many sections; while a given section may be associated with many students, there is no unambiguous way of identifying which set of records in one table belongs to a single record in the other. It comes out that neither table can effectively contain the attribute final_grade. As a result, the relational model does not support the direct implementation of many-to-many relationships and the only solution is to break the many-to-many relationship into a pair of binary, one-to-many relationships. This is achieved by introducing a third table to the pattern. These “third” tables have various names, but are most commonly referred to as either “intersection”, “composite”, or “cross-reference” tables. 1
  • 2. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 The new intersection table (the Registration table) then, will be utilized to eliminate the many-to-many relationship that exists between students and sections. The Primary Keys of the Student and Section tables, respectively, are both placed into the intersection table as a Foreign Key, such that the Primary Key of the intersection table is a composite of the two Foreign Keys. Additionally, it will contain the attribute final_grade. Creating the Student Table 1. Open the Course Database (you created in Tutorial I) in MS Access 2007. From the Table Tools palette, select the Create tab, and click on Table. 2. Under the All Tables pane, right click on Table1 : Table and select Design View from the drop down menu . (In the Save As dialog box, under Table Name, type Student and click OK . 2
  • 3. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1   3. (a) Under the Student tab, under Field Name, enter Field (or column) names as follows: student_ID (primary key), last_name, first_name, address, city, state, zip and ssn. (b) Under Section tab, under Data Type, click the down-arrow for the student_ID to select Text. 4. When you are done, right-click on the Student tab and click Save on the drop down menu. 5. Under All Tables, double-click on Student : Table. Enter the data as shown below. 3
  • 4. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 6. When you are done, right-click on the Student tab and click Save on the drop down menu 7. Right-click again and select Close All … and Yes to “save changes to the layout of table Student”. Creating the Registration (intersection) Table 8. From the Table Tools palette, select the Create tab, and click on Table. 4
  • 5. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 9. Under the All Tables pane, right click on Table1 : Table and select Design View from the drop down menu . (In the Save As dialog box, under Table Name, type Registration and click OK .   10. (a) Under the Student tab, under Field Name, enter Field (or column) names as follows: student_ID, section_ID and final_grade. (b) Under Section tab, under Data Type, click the down-arrow for the student_ID to select Text. 11. Holding down the Ctrl key, click both of the blue boxes preceding the rows (highlighted here in red) for both student_ID and section_ID. Then click the Primary Key button on the Design palette. 5
  • 6. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 12. Right-click on the Registration tab and select Save. 13. Enter the data for student_ID, section_ID and final_grade as shown below. 6
  • 7. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 14. Right-click on the Registration tab and select Save from the drop down menu. 15. Right-click again on the Registration tab and select Close All from the drop down menu. 7
  • 8. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 Creating relationships between the tables 16. From the Database Tools palette, click on the Relationships button. 17. Under the All Tables pane, click on the Section : Table to highlight it and then drag and drop it over onto the Relationships view. 18. Repeat this step for the Student : Table and the Registration : Table. Then re-arrange the tables so that the Registration (intersection) Table is located in the middle. 8
  • 9. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 19. To join the tables together with referential integrity, first highlight section_ID in the Registration table (shown above), then drag this section_ID attribute to the left over to the Section table, dropping it on top of the section_ID attribute there. When the Edit Relationships dialog box appears, check all three check boxes: the Enforce Referential Integrity, Cascade Update Related Fields and Cascade Delete Related Records check boxes; and click the Create button. 20. Then, highlight student_ID in the Registration table (shown below), and drag this student_ID attribute to the right over to the Student table, dropping it on top of the student_ID attribute there. 21. When the Edit Relationships dialog box appears, check all three check boxes: the Enforce Referential Integrity, Cascade Update Related Fields and Cascade Delete Related Records check boxes; an click the Create button. 9
  • 10. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 You should now have successfully linked all three tables together, having created two binary one-to- many relationships constrained with referential integrity as shown below. 22. Right-click on the Relationships tab and click Save from the drop down menu. 10
  • 11. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 23. Right-click again on the Relationships tab and click Close All from the drop down menu. Querying the database 1. From the Create Palette, select Query Wizard. 2. At the New Query screen, accept the default Simple Query Wizard by clicking OK. 11
  • 12. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 3. The Simple Query Wizard displays. Under Tables/Queries, click the drop down arrow to select the Table : Registration. Then transfer final_grade from Available Fields to Selected Fields by clicking the arrow show below in the red box 4. Under Tables/Queries, click the drop down arrow to select the Table : Student. Transfer last_name and first_name from Available Fields to Selected Fields by clicking the arrow as before. 12
  • 13. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 5. Click the Finish button to see the results of the query below. Conclusion 13
  • 14. Copyright © 2009 Bahn, D., Tang, H. & Yardley, A. All Rights Reserved. ISBN: 978-1-936203-03-1 In this tutorial, we learned how to use an intersection table (the Registration table) to eliminate the many- many relationship between student and sections, and effectively link the tables together accordingly with referential integrity. We then successfully performed a query leveraging this implementation. Systems Analysis and Design Learning Module Series #2 Document version Creating an Intersection Table in a Relational Database 14