Home › Interview Questions › How would you design a customer table with Custome…

How would you design a customer table with CustomerID as the primary key and columns for customer name, phone, email, address, and last updated date?

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

💡 Model Answer

When designing a customer table, you start by defining the primary key, which in this case is CustomerID. It should be a unique, non‑nullable column, often an auto‑increment integer or a UUID. Next, decide on data types: CustomerName as VARCHAR(255), PhoneNumber as VARCHAR(20) to accommodate formatting, Email as VARCHAR(255) with a UNIQUE constraint, Address as a composite column or separate columns (Street, City, State, Zip) depending on normalization needs. The LastUpdatedDate column should be a TIMESTAMP with a default of CURRENT_TIMESTAMP and an ON UPDATE clause to automatically capture changes. Add NOT NULL constraints where appropriate, and consider indexing frequently queried columns like Email or PhoneNumber. If you anticipate high write volume, partition the table by a business key such as Region. Finally, document the schema and enforce referential integrity if the customer table is referenced by orders or transactions.

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