Courseiva
Design and implement database schemasmediumMultiple ChoiceObjective-mapped

PCDE Design and implement database schemas Practice Question

A team is designing a relational schema for a new application on Cloud SQL. The schema includes a table 'Orders' and a table 'Customers'. Each order belongs to one customer. The team anticipates high write throughput and needs to enforce referential integrity. Which schema design is most appropriate?

⚠ Common exam trap

Google Cloud often tests the misconception that application-level checks are sufficient for high-throughput systems, but the trap here is that database-level foreign keys are the only way to guarantee referential integrity under concurrent writes, as application code cannot prevent race conditions or orphaned records.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use a foreign key constraint from Orders.customer_id to Customers.customer_id

Using a foreign key constraint from Orders.customer_id to Customers.customer_id enforces referential integrity at the database level, which is essential for maintaining data consistency in a relational schema. Cloud SQL (e.g., MySQL or PostgreSQL) natively supports foreign key constraints, ensuring that every order references an existing customer without relying on application logic. This approach is efficient for high write throughput as the database handles the check atomically, avoiding race conditions.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use Cloud Spanner interleaved tables with Orders as a child of Customers

    Why it's wrong here

    Interleaved tables do not enforce foreign key constraints across non-interleaved tables.

  • Implement referential integrity checks in the application code and omit database constraints

    Why it's wrong here

    Risk of data inconsistency due to concurrent writes.

  • Store order data as a JSON array in a column of the Customers table

    Why it's wrong here

    Denormalization leads to update anomalies and poor query performance.

  • Use a foreign key constraint from Orders.customer_id to Customers.customer_id

    Why this is correct

    Enforces integrity efficiently within the database.

About these practice questions

This PCDE question is part of Courseiva's 1,446-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCDE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCDE exam.