Hi Everyone,
I'm very new to data verse and working on few apps now. Came across this question and trying to make myself understand about the relationships in data verse.
I have a list A: Teachers
Another list B: Students
In One-to-many relation, One teacher can have multiple students.
In many to one, Many students can have one teacher.
So in one to many which is correct one and how do I establish relation for such.
Case 1 Case 2
Teacher Student Name Teacher StudentName
Sarah David Sarah David, Dany, Sam
Sarah Dany
Sarah Sam
Can someone please help me? Thanks so much in advance!
Hi @Anonymous ,
You would have two tables as you mentioned (main and child).
The main table would have one field for the Name (if the ID itself is not something you are concerned on tracking, if it is then you would have two fields). The reason I say this is that Dataverse will track a GUID behind the scenes for the record.
The Child table would have the Requestor, Date, and a Lookup column to the Main table. When you add the Lookup column on this table it will automatically create the N:1 relationship back to the Main table.
You might also want the Requestor to be a Lookup column as well back to the User or Contact table so you can uniquely track the Requestors across multiple records in the Child table. Also, again, if you want the ID column then you can add this as well but there is a GUID behind the scenes...
When importing the data from Excel for the Child table you would populate the value of the import column for the related Main record with value of the Main table's Name field. As long as there are no duplicates of this Name value in the Main table it will resolve and populate the lookup value relating the two records.
Hi @dpoggemann ,
Thanks for the help. The one I gave you is the sample one. Here's another tables and would like to establish a relationship and import two excel's data into these two tables.
Step 1: creating two tables with relationship
Step 2: import excel tables into two tables.
Main list
Item ID Name of the Item
121 ItemOne
145 ItemTwo
345 ItemThree
Child List
ChildID ItemID Date Requestor
6578 121 8/8/2023 Dan
8679 345 8/12/2023 Sarah
7683 145 8/15/2023 Phil
Created tables Main and Child
On Main list created relationship as one-to-many, names it CollLookUp and related table as Child list.
Can you please correct me if I'm doing anything wrong in here. May be I'm over thinking or looking more deep kind of running into confusion.
Appreciate your patience and time! Thank you so much
You could also do a default N:N relationship as well where the Student can have multiple teachers and the teacher can have multiple students and this will create a table (behind the scenes) in Dataverse that will manage the intersect. Some nice features with this on selecting multiple students to relate to the teacher on the UI nicely.
The downfall of this approach is you cannot add the additional metadata on the relationship as I mentioned above.
Hi @Anonymous ,
Normally in this situation I would create a custom intersect table to handle the Teacher having multiple students and the student having multiple teachers and on the Intersect table you could also have additional fields to define the relationship (like start / end dates etc.).
Teacher (1) -----> (N) Teacher Student (N) <-----------(1) Student
So in this case you would have 3 tables.
stampcoin
17
ankit_singhal
11
Super User 2025 Season 1
mmbr1606
9
Super User 2025 Season 1