Google Cloud Professional Cloud Developer — Question 69

You are designing a schema for a Cloud Spanner customer database. You want to store a phone number array field in a customer table. You also want to allow users to search customers by phone number.
How should you design this schema?

Answer options

Correct answer: D

Explanation

Answer D is correct because interleaving the Phones table with the Customers table allows for efficient querying of phone numbers related to customers, and creating an index on the phone number field enhances search performance. Option A does not allow for efficient searching, while option B separates the data unnecessarily. Option C, while it allows searching, does not leverage the benefits of interleaving, which is optimal for this use case.