Foreign Keys and Inner Joins



  • Kathryn Lenth Westminster College


In this activity, students are introduced to the concept of a foreign key by inspection of related tables in a domain familiar to them (college classes and professors). After forming the concept of a relationship between tables, students are introduced to the SQL INNER JOIN ... ON ... syntax and given the chance to practice a few simple queries using joins.

This activity is designed to be the first contact with table relationships, foreign keys, and SQL join syntax for a junior-level databases class for computer science and related majors. Before starting this activity, it is expected that students are already familiar with the concepts of relational tables and primary keys and that they be able to connect to a live database and run queries on it.

This activity was developed with NSF support through IUSE-1626765. You may request access to this activity via the following link: IntroCS-POGIL Activity Writing Program

Level: Undergraduate (junior-level)
Setting: Typical classroom with students working in groups of 3–4; access to individual computers and network (for connection to live database) required 
Activity type: Learning Cycle
Discipline: Computer Science
Course: Databases
Keywords: relationship, foreign key, inner join




How to Cite

Lenth, K. (2022). Foreign Keys and Inner Joins: Database. POGIL Activity Clearinghouse, 3(4). Retrieved from



CS-POGIL Activity Writing Program