HomeInterview QuestionsWhen ingesting data, if the source table has no pr…

When ingesting data, if the source table has no primary key, is it mandatory to externally define primary key columns in the target, or can we ingest without them?

🟡 Medium Conceptual Junior level
1Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

It is not mandatory to define a primary key in the target if the source has none, but it is highly recommended. Without a key, you risk duplicate rows during incremental loads and cannot efficiently perform upserts or deletes. The typical solution is to add a surrogate key in the target (e.g., an auto‑incrementing sequence or UUID) and, if possible, create a unique constraint on a combination of business columns that uniquely identify a record. This allows you to perform idempotent loads and maintain referential integrity. If the downstream system does not require a key, you can skip it, but you should document the decision and ensure that any downstream processes can handle duplicates or lack of uniqueness.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500