@JohnYu500
@JohnYu500 wrote:
Could someone please tell me:
1) What is the difference between a lookup table and a relationship? When should I use one vs the other?
We are unfamiliar with the terminology of a "lookup table" in Dataverse.
If you meant a "lookup column" (ref) versus a "relationship", here is explanation:
The "relationship" you are referring to, the main kind which is 1:N , let's suppose that one Account record can have many Contact records. The subgrid would be on the Account record, and can list 0, 1, or more than 1 Contact records associated with it.
On the other side of the perspective, the same relationship exists as Many to One, or N:1 between Contacts and Accounts - which is the same relationship actually, just seen from the other end.
Only this time, any one distinct Contact record optionally has a specific reference to exactly one Account record, usually visually represented through a lookup column (previously called a lookup field) on the Contact. Another distinct Contact record, also can have the reference in the lookup column pointing to that same specific Account record as well. This would cause there to be those two exact contact records to be shown in the subgrid on the Account record side, and on each of the two distinct Contact records, the lookup field set to be pointing to the same Account record. So many Contacts can have one Account or N:1 from Contact to Account.
The N side of the relationship usually has the lookup field on it, or what is called a lookup column. (note that field has recently been renamed to column, as part of the round of name changes related to CDS rename to Dataverse)
@JohnYu500 wrote:
The concepts seem different from the old relational database design concepts.
No this part is the same actually.
In our opinion it is just being represented in a little bit easier way actually. When you see a lookup column (formerly lookup field) on a record form, you can already tell that this Table (formerly called an Entity) has to have an N:1 there in some way. When you see a subgrid on a record form, you can already tell it has to have a 1:N in there for that Table (formerly called an Entity).
So that is why Dataverse is quite useful and powerful in this respect as it matches very well with database design concepts.
Let us know which part you think is very different from relational database design concepts.
Finally, here are some visual examples to help more with the above:
Account View

Contact View

Account Records:
Account 1 Record Form Subgrid listing both of the 1:N associated Contact Records

Account 2 Record Form Subgrid listing the associated 1:N associated Contact Records(there happens to just be one here, but there can be zero associated records, one associated record, or more than one associated record)

Contact Records:
Contact Number One Record Form with lookup column (previously called a lookup field) N:1 pointing to Account 2:

Contact Number Two Record Form with lookup column (previously called a lookup field) N:1 pointing to Account 1:

Contact Number Three Record Form with lookup column (previously called a lookup field) N:1 pointing to Account 1:

In all three of the above screenshots of each Contact record, the lookup column (previously called a lookup field) points to exactly one Contact record. However, notice that more than one of these records can possibly point to the same record - that is why it is N:1 and not 1:1.
In Dataverse, a true 1:1 relationship between two tables cannot be modeled natively in the specific way you might have in mind (without some specific potential workarounds), this might be the only real difference. A one to one relationship in Dataverse is usually natively built as just another regular column (formerly called a field) on the same Table.
Moreover, note it is also possible for the lookup column (N:1) on a Contact record to be simply left blank and not point to any single Account record at all (unless it is set as a required field) - the relationship and lookup by themselves do not necessary imply that the record must be associated, only that it can be associated.
We also use the word record very often to deliver the following point.
The definition of a Table (formerly called an Entity) is very different from the actual records contained in that table. The 1:N relationship is best understood keeping the records of the Tables in mind. The records are the actual things that end up having the relationship with other records - the Tables are just the ones that determine through definitions of the relationships, that the relationships are possible between the records of those Tables in those specific ways. The lookup column is usually the hint of the N:1 relationship, and subgrid the sign of the 1:N relationship. Note that the column and the subgrid need not be actually present on the form for the relationship to exist, but if they are present, they are how you can easily tell the relationships and in what direction they are.
In other words, placing a subgrid on a form to show one, or more than one associated record from another table,
usually requires the 1:N relationship to be defined first between the two tables,
and placing a lookup column on a form to reference one associated record from another table,
usually requires the N:1 relationship to be defined first between the two tables.
Hope this helps.