A candidate and an interviewer are discussing how to optimize data for a reporting dashboard.
Interviewer: Let’s look at how we fetch data for the monthly sales dashboard. Before we jump into writing the query, would you describe the relationship between the Customers and Transactions tables?
Candidate: Sure. A customer can have multiple transactions. So, want to do is establish a one-to-many relationship using the customer_id.
Candidate: If we join them on that ID, what it is give us a single table with all the customer details right next to their purchases.
Interviewer: Makes sense. But the dashboard is loading very slowly right now. We need a way to limit the data size.
Candidate: We could easily do that adding a date filter at the query level, so we only fetch the last 6 months.
Interviewer: We also considered building a separate, pre-aggregated database just for this dashboard.
Candidate: For a simple date limit? Just filtering the current query… more sense here. It avoids the overhead of maintaining a second database.
Candidate: Plus, if we keep it in the main query, quickly adjust the date range if the business team changes their mind next week.
Show correct answers
- [ 1 ] A) How
- [ 2 ] B) one thing you generally
- [ 3 ] B) does
- [ 4 ] A) by
- [ 5 ] B) that would make
- [ 6 ] A) this allows us to