Many to Many relationship without duplicates

Hello, me and a colleague are trying to make a database where we have a table called "students" and one called "subjects", meaning many students can take many subjects. We've been researching for a bit and the way explained in the Appian Documentation is the one explained here, it says create both the parents and child CDTs, then create a third table where you have: a primary key, a foreign key that corresponds to the first table, a foreign key that corresponds to the second table, and an index. The problem is that by doing so, you can add duplicates of each, meaning that the same student can be assigned to the same subject twice (this screenshot is the Intermediary record type):

(I made 3 record types, Subjects, Students and Intermediary). That's why I wanted to ask all of you for any suggestions so that this table does not take duplicates, or if there's anything that we are doing wrong. Thank you!

  Discussion posts and replies are publicly visible

Parents Reply
  • I don't think this will actually work - Appian only supports a single key as the primary key field, so you won't be able to insert or update data (regardless of whether you are using CDTs or Record Types).

    If you are truly concerned about this case, I'd recommend doing both of what Stefan mentioned - that way it provides a good user experience for users and you can be certain there are no duplications.

Children