What is a foreign key constraint in SQL? Explain its purpose, how it maintains referential integrity, and provide examples of its implementation in a relational database.
The interviewer expects a clear understanding of foreign key constraints, including their definition, use cases, and potential pitfalls in database design.