exam questions

Exam DP-420 All Questions

View all questions & answers for the DP-420 exam

Exam DP-420 topic 1 question 4 discussion

Actual exam question from Microsoft's DP-420
Question #: 4
Topic #: 1
[All DP-420 Questions]

HOTSPOT -
You have a database in an Azure Cosmos DB Core (SQL) API account.
You plan to create a container that will store employee data for 5,000 small businesses. Each business will have up to 25 employees. Each employee item will have an emailAddress value.
You need to ensure that the emailAddress value for each employee within the same company is unique.
To what should you set the partition key and the unique key? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: CompanyID -
After you create a container with a unique key policy, the creation of a new or an update of an existing item resulting in a duplicate within a logical partition is prevented, as specified by the unique key constraint. The partition key combined with the unique key guarantees the uniqueness of an item within the scope of the container.
For example, consider an Azure Cosmos container with Email address as the unique key constraint and CompanyID as the partition key. When you configure the user's email address with a unique key, each item has a unique email address within a given CompanyID. Two items can't be created with duplicate email addresses and with the same partition key value.

Box 2: emailAddress -
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/unique-keys

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
ognamala
Highly Voted 1 year, 2 months ago
Solution is correct - companyId for partition key, and emailAddress for unique key Additional justification why you would definitely set the partition key to companyId, is by also keeping potential queries in mind, typically in this scenario you will always end up with an equality filter on the companyId, hence it makes sense to partition by companyId, which will result in better query performance UniqueKey will need to be set to emailAddress, since the job of a unique key is to ensure uniqueness of a value within a logical partition https://docs.microsoft.com/en-us/azure/cosmos-db/unique-keys
upvoted 12 times
...
azuredemo2022three
Most Recent 4 months, 3 weeks ago
The given answer is correct Partition Key: CompanyId Unique Key: emailAddress
upvoted 2 times
...
lakime
1 year, 6 months ago
Correct - Logical partitions are formed based on the value of a partition key that is associated with each item in a container. All the items in a logical partition have the same partition key value. So segregating by companyid makes sense E-mail will be unique
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago