Home › Interview Questions › Instead of using a hash, what alternative approach…

Instead of using a hash, what alternative approach can you use with existing columns to detect changes, and how would you implement it?

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

💡 Model Answer

Instead of hashing, you can use a composite key or a checksum column to detect changes. For example, create a ROW_NUMBER() or ROW_HASH using a database function like CHECKSUM_AGG in SQL Server or MD5(CONCAT(col1, col2, …)) in MySQL. Store this checksum in an existing column that is rarely updated, such as a version or last_modified field. When comparing two tables, join on the primary key and compare the checksum columns: WHERE t1.checksum <> t2.checksum. This avoids storing a separate hash column and leverages existing columns. Alternatively, use a trigger to update the checksum whenever any of the relevant columns change. This approach keeps the schema lean while still providing fast change detection.

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 on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500