I'm looking at this database model and I'm confused about the "PF" in some of the tables. My understanding is that the PF is a "Primary/Foreign key" which could also be a composite key. I understand this situation for a many-to-many relationship, but what about situations such as the Menu_Courses
table? The primary key would obviously be an auto-incremented column of type int, but what about the menu_id
field? How would that be implemented in a database such as SQL Server?
The author also explains PF fields on this page: http://www.databaseanswers.org/tutorial4_db_schema/tutorial_slide_5.htm
The way I understand it is that these fields are primary keys on the table they are defined on, and at the same time they are foreign keys to other tables.
menu_courses
has the reference to suggested_menus
through menu_id
and combined with course_number
makes the primary key - that is each menu/course number combination is unique and uniquely identifies a row on the table.
You would normally implement this as a foreign key field on the suggested_menus
table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With