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

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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