How to show composite keys in Chen E-R Diagram - erd

How to show composite keys in Chen E-R Diagram? I have not used this notation and I really don't like it. Any references would suffice, as I have excellent understanding of data modeling concepts (what a brag!).
Note: I am aware of the symbol for associative entity, in such a symbol, one may have an auto-increment key as the PK, but then again, one may use the 2 FKs. In the later case, the PK would be composite. I don't know how to show it since Chen attribute symbol is an oval for each attribute.
Thanks.

You can underline the text of each attribute that is involved in the primary key:
Note that an associative entity set normally has a composite key. Introducing a surrogate key changes it into a regular entity set with its own identity. Associative entity sets are really just relationships which are the subjects of further relationships, and relationships are identified by the entity keys of the related entity sets.

Related

AX 365: is it possible to create table relations automatically? Like it was in Ax 2009?

I have a table FooGroupTable with a primary key FooGroupId of EDT type FooGroupId (and the EDT references FooGroupTable.FooGroupId through table reference)
I also have another table FooTable and I want to make a field FooTable.FooGroupId which references FooGroupTable.FooGroupId: any value that user enters on form into FooTable.FooGroupId should exist in FooGroupTable.FooGroupId.
How to do it in the most efficient way? In Ax 2009 I would just choose EDT and call it day: lookup would work, a check that a value entered in FooTable.FooGroupId exists in FooGroupTable table would be done automatically without me jumping through hoops.
In AX 365 automatic EDT relations are no more.
When I drag'n'drop EDT into fields to make a new field, there is no dialog asking me if I want to make a relation.
I can't drag'n'drop field into relations.
The only way I see is to create table relation manually.
Is there a better way?
TLDR;
In short: no, there does not seem to be a way to create table relations automatically like in AX 2009 based on the extended data type's metadata information.
As the warning in Extended Data Types in the Database states:
Starting in Microsoft Dynamics AX 2012, you can no longer define relations under an EDT element in the AOT.
Note that the extended data types in AX 2012 and D365FO still show a relations node. This is for backwards compatibility to still allow standard extended data types with relations. But for new extended data types, no relations can be defined.
Why?
So why would Microsoft remove this way of defining relations?
Some answers can be found in the Migrating Extended Data Type Relations (White paper). In the introduction, the white paper says:
Table relationships under an EDT
have some disadvantages:
They do not contain the rich relationship metadata, such as cardinality and relation type, that can
be included in relations under a table node.
They can only capture single field relationships, which might not represent the intended — and possibly more intricate — relationship between the tables.
A significant difficulty with having table relations defined under both an EDT and a table is that the
order of relations matters when table relationships are defined in both locations. In such cases, the
kernel will use different algorithms to decide which relationship to examine first, depending on the
context.
The "Add relation?" dialog
The question mentions a dialog when dragging and dropping an extended data type into the fields node of a table asking the user if a relation should be created. This dialog still exists, but compared with earlier versions, it is offered for fewer extended data types (e.g. in AX 2012 it is offered for the ItemId extended data type, in D365FO it is not).
The conditions under which this dialog is offered or not seem to be a combination of the table reference settings on the extended data type and the primary index of the table that is referenced by the extended data type. However, so far, I was only able to find examples where the primary index is set to the default value "Surrogate key" where the dialog is offered. One such an example is the extended data type OMDepartmentRecId, which offers the following dialog in D365FO:
More information
Apart from the previous two links, I would also like to mention a blog article by David Kidder: ReferenceTable & Table References on EDT (images are unfortunately missing and I couldn't find a version of it that has them).
It describes the various combinations of the table reference settings of an extended data type and what the resulting behavior is. It also mentions the "Add relation?" dialog, but at least for D365FO, the description doesn't match the current behavior any more.

How to select a partition key for a Graph database in Azure CosmosDB

I am working with Azure CosmosDB, and more specifically with the Gremlin API, and I am a little bit stuck as to what to select as a partition key.
Indeed, since I'm using graph data, not all vertices follow the same data schema. If I select a property that not all vertices have in common, Azure won't let me store vertices which don't have a value for the partition key. The problem is, the only property they all have in common is /id, but Azure doesn't allow for this property to be used as a partition key.
Does that mean I need to create a property that all my vertices will have in common ? Doesn't that kill a little bit the purpose of graph data ? Or is there something I'm missing out ?
For example, in my case, I want to model an object and its parts. Each object and each part have a property /identificationNumber. Would it be better to use this property as a parition key, or to create a new property /partitionKey dedicated to the purpose of partitioning ? My concern is that, if I select /identificationNumber as the partition key, and if my data model has to evolve in the future, if I have to model new objects without an /identificationNumber, I will have to artificially add this property to these objects the data model, which might lead to some confusion.
Creating a dedicated property to use as a synthetic partition key is a good practice if there isn't an obvious existing property to use. This approach can mitigate cases where you don't have an /identificationNumber in some objects, since you can assign some other value as the partitionKey in those cases. This also allows flexibility around refactoring /identificationNumber in the future, since partitionKey is what needs to be unchanging.
We shouldn't be concerned about an "artificial property" because this is inherent with using a partitioned database. It doesn't need to be exposed to users, but devs need to understand Cosmos is somewhat different than traditional DBs. It's also possible to migrate to a new partition key by copying all data to a new container, in the worst case of regret down the road. It's probably best to start working on the project with a best guess and seeing how things work, and perhaps iterating on different ideas to compare performance etc.

Yes/No attributes in logical database design

I have an assignment where I have to design a logical model using SQL developer.
I am converting a conceptual model to a logical model. And I Have a relation NURSE that has "nurse_id" and "certification". The certification attribute has yes/no values.
My question is:
Should I move the yes/no attribute to a new relation? or is it okay to keep it in the same NURSE relation. What is the best practise.
and is the suitable data type for that attribute (CHAR)?
Thank you,
Keep it in the NURSE relation as it would be easy to query how many nurses have certification and how many don't, and which nurses have certification.
You can use either CHAR(1) and type in Y or N. You can use a BIT datatype if database supports it. You can use a Boolean if database supports it. Since all major databases will have a CHAR(1), I'd just keep it CHAR(1)
Because the certification only has yes/no values, I would recommend keeping them in the same table as a one to one mapping. If one nurse could get several certifications, then another table would be useful as a many to one or one to many mapping.
As for the data type, CHAR is fine. If you want to save space you can also use BOOLEAN, then parse this as yes/no in the application.

Differences between has and contains relationship in ERD?

ERD from Wikipedia:
I'm confused to distinguish "has" and "contains" relationship in ERD, what's the difference between them?
With regards to the linked diagram from Wikipedia, both Has and Contains are one-to-many relationships (1..n) with total participation of Character in the relationship (double association line). Total participation means every Character must be related to an Account and a Region.
However, the Has relationship is marked as an identifying relationship (double-bordered diamond) and Character is marked as a weak entity set (double-bordered rectangle). This means that the identifying attributes of Character include the identifying attributes of Account. Character has a weak key CharName, which must be combined with AcctName to fully identify a Character. In other words, the primary key of the Character table will be composite: AcctName, CharName.
Note that these comments apply to the example ERD, not to ERD in general. Has and Contains aren't types of relationships - in general, a relationship can be called anything and have any combination of the features available in ER theory.
Also, see my answer to Is optionality (mandatory, optional) and participation (total, partial) are same?

Crows-foot notation in an Sqlite database model

I'm getting to grips with using 'crows-foot' notation to design Sqlite databases using Navicat. In a book chapter designed to get users up and running with this software I have come across the following example, consisting of an ER diagram and some explanatory text:
There is a many-to-one relationship between the category table and the task table. In our case, a task can have one category associated with it, but a category can have many tasks under it. As such, a task can be assigned to one user, but a user can have many tasks.
I was surprised to read this because the notation seems to be at odds with the description. My way of reading these diagrams (arrived at by examining various freely available examples on the internet) is to start with the table (say Task) then look at the notation that is 'attached' to the related table (in this case 'one or more') and construct the relationship as follows: Task belongs to 'one or more' Categories. Such a relationship is possible of course, but it seems inconsistent with the verbal description of the desired relationship, namely: 'a task can have one category associated with it'. Am I misunderstanding crow's-foot notation?
In ERD (whether using Crow's foot or Chen notation) the "many" side has always the foreign key, The Task table has the foreign key Category_id and therefore is on the "many" side while Category has the related primary key named ID and therefore is on the "one" side. So, you're right in your interpretation actually.

Resources