I am studying database from Database System Concepts.
The author was explaining foreign keys and referential integrity with the help of following schemas:
$$ instructor(\underline{ID},\space name,\space dept\text_name,\space salary)$$ $$ course(\underline{course\text_id},\space title, \space dept\text_name,\space credits) $$ $$ department(\underline{dept\text_name}, \space building,\space budget)$$ $$ section(\underline{course\text_id,\space sec\text_id,\space semester,\space year},\space building,\space room\text_no,\space time\text_slot\text_id) $$ $$ teaches(\underline{ID,\space course\text_id, \space sec\text_id,\space semester, \space year})$$
The primary keys are underlined.
The relation $section$ is used so that each course could be offered multiple times, across different semesters, or even within a semester.
Foreign key was explained with the help of schemas $instructor$ and $department$. The attribute $dept\text_name$ in in $instructor$ is a foreign key from $instructor$ referencing $department$.
It need not be the case that all $dept\text_name$ values are referenced by $instructor$ relation.
Referential integrity constraint was explained with the help of $section$ and $teaches$ schema.
If a section exists for a course it must be taught by at least one instructor(it could be taught by more than one instructor)
So all the combinations of $(course\text_id,\space sec\text_id,\space semester, \space year)$ that appear in $section$ relation must also appear in $teaches$ relation.
But we cannot declare a foreign key from $section$ to $teaches$ since multiple instructors could teach a single section.
We could define a foreign key from $teaches$ to $section$.
Since we could form a referential integrity constraint from $instructor$ to $department$ by using foreign key but without foreign key we have referential integrity constraint from $section$ to $teaches$.
So how is referential integrity different from foreign key constraints?
Also if you know some free resources that could clear database concepts please share.