I am still working on a photo storage app (designing the database for the data for the photos stored), using MySQL, and have been told that a photo may have one or more people in it, and a person may be in many photographs, which makes sense.
My issue is in understanding the properties of the linking table between the photo and person tables. I have set up a linking table with the PK of both tables (Photo and Person) as the composite PK for the linking table. Both sets of PK in this table are set to Not Null (by me) but the project then stipulates that people can be in the database even if they aren’t in a photo, and I was wondering how this tallies with the NN setting of the composite PK. Surely if it has to be NN, this means it can’t allow for there to be any entries where I just have the PK of the photo and none for the person part of the linking table? Or am I totally misunderstanding how these relationships work? As mentioned previously, I am in the early stages of learning about databases.