using databases and sql foreign key is usually number that points to the primary key of an associated row in different table an example of foreign key in our data model is the from_id we are using naming convention of always calling the primary key field name id and appending the suffix _id to any field name that is foreign key using join to retrieve data now that we have followed the rules of database normalization and have data separated into two tableslinked together using primary and foreign keyswe need to be able to build select that reassembles the data across the tables sql uses the join clause to reconnect these tables in the join clause you specify the fields that are used to reconnect the rows between the tables the following is an example of select with join clauseselect from follows join people on follows from_id people id where people id the join clause indicates that the fields we are selecting cross both the follows and people tables the on clause indicates how the two tables are to be joinedtake the rows from follows and append the row from people where the field from_id in follows is the same the id value in the people table people follows id name retrieved drchuck opencontent lhawthorn steve_coppin name id drchuck drchuck drchuck from_id to_id from_id to_id name opencontent lhawthorn steve_coppin figure connecting tables using join