exam questions

Exam DP-420 All Questions

View all questions & answers for the DP-420 exam

Exam DP-420 topic 2 question 3 discussion

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

HOTSPOT -
You have a database named telemetry in an Azure Cosmos DB Core (SQL) API account that stores IoT data. The database contains two containers named readings and devices.
Documents in readings have the following structure.
✑ id
✑ deviceid
✑ timestamp
✑ ownerid
✑ measures (array)
- type
- value
- metricid
Documents in devices have the following structure.
✑ id
✑ deviceid
✑ owner
- ownerid
- emailaddress
- name
✑ brand
✑ model
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: Yes -
Need to join readings and devices.

Box 2: No -
Only readings is required. All required fields are in readings.

Box 3: No -
Only devices is required. All required fields are in devices.

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
jdsherrington
Highly Voted 1 year, 8 months ago
Answer is NYN. 1. N: The readings container does not need to be read to return all deviceids associated with a particular emailaddress, so only one query is needed: SELECT * FROM devices d WHERE d.owner.emailaddress = ________ 2. Y: measures is an array, and to filter or project fields from an array, you need to use join to create a cross join with the array. SELECT r.deviceid, r.ownerid, r.timestamp, m.value FROM readings r JOIN m IN r.measures WHERE m.metricid = ________ 3. N: owner is an object, not an array, so you can directly access the properties. deviceid, ownerid, emailaddress and model all exist in the devices container, so the readings container is not needed. SELECT d.deviceid, d.owner.ownerid, d.owner.emailaddress, d.model FROM devices d
upvoted 24 times
WimTS
2 days, 2 hours ago
exact, only it should be d.name.model
upvoted 1 times
...
SwePha
1 year, 5 months ago
Awesome explanation
upvoted 2 times
...
...
grada
Highly Voted 2 years, 9 months ago
Who ever wrote the suggested responses has no idea of what a JOIN does in a document database... it has nothing to do with joining documents, but is an inner-document join. It's NYN if the first questions means returning only devices, and none of the readings. It's YYN otherwise, because readings are in a separate container, and should be fetched using a second query.
upvoted 16 times
...
8a6a5d3
Most Recent 7 months, 3 weeks ago
1. No. Given the structure of your Cosmos DB containers and the documents, if you want to return all devices owned by a specific emailaddress, you might be able to do this with a single query depending on the structure and indexing of your Cosmos DB. However, if you're joining data across the readings and devices containers, and if the data is not normalized or if specific data exists in one container but not the other, you may need to execute multiple queries 2. No. Since all the required data (deviceid, ownerid, timestamp, and value for a specific metricid) is located within the same container (readings), there is no need to perform a join across multiple containers. You can retrieve all this data with a single query on the readings container. 3. No. All the requried data (deviceid, ownerid, emailaddress, and model) is located within the same container (device), there is no need to perform a join across multiple containers. You can retrieve all this data with a single query on the readings container.
upvoted 2 times
...
Shiven
1 year, 8 months ago
N - Device container has all required info. N - In Reading container we have everything. Y - Need to join 2 containers.
upvoted 4 times
...
azuredemo2022three
1 year, 9 months ago
Answer YYN
upvoted 1 times
...
avocacao
2 years, 3 months ago
Y - requires 2 requests to get from 2 containers Y - need join to get 'value' in measures array Y - need join to get 'ownerid' and 'emailaddress' in owner array https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/join
upvoted 4 times
Alex22022
2 years, 2 months ago
Third - No; Devices container: select c.deviceId, c.owner.ownerId, c.owner.emailaddress, c.model from c
upvoted 1 times
...
...
Internal_Koala
2 years, 6 months ago
No. Yes. Yes. ==================== First: No SELECT * FROM d WHERE d.emailaddress = "To return (?) for all devices ...". Sounds like the word "metrics" might be missing. If so, the answer is Yes and a second query must be added. =========== SELECT d.deviceid FROM d WHERE d.emailaddress = ? SELECT * FROM m WHERE m.deviceid = @deviceid ==================== Second: Yes SELECT m.deviceid FROM m WHERE m.metricid = ? SELECT d.deviceid, o.ownerid, d.timestamp FROM d JOIN o IN d.owner WHERE d.deviceid = @deviceid ==================== Third: Yes SELECT d.deviceid, o.ownerid, d.emailaddress, d.model FROM d JOIN o IN d.owner
upvoted 9 times
susejzepol
2 years, 4 months ago
i think like you.
upvoted 1 times
...
nope1234567
2 years, 4 months ago
I disagree on the second one. All fields to return are in the Readings container, why would you need to join the second container ? FK are sufficients here
upvoted 2 times
...
...
kdsingh
2 years, 11 months ago
The correct answer is YYN - Yes: you need 2 requests, because the data is in 2 different containers. - Yes: you need join to get the data from Array - No: No joins required
upvoted 7 times
ognamala
2 years, 8 months ago
Why would the second one be yes ? We dont need any data from the array.
upvoted 3 times
Alex22022
2 years, 2 months ago
Because you need value and metricid properties from the measures array.
upvoted 1 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