
Answer-first summary for fast verification
Answer:
The question requires creating a data object that automatically stays up-to-date when new data is added to the sales table. A view is the correct choice because it provides a virtual table that reflects the current state of the underlying tables without storing data persistently. Option D uses the correct syntax for creating a view with a JOIN and aggregation, ensuring the sales_by_employee object always shows the latest data from both tables. Option E creates a table, which would not automatically update when new data is inserted into the sales table without manual refresh operations. The community discussion shows strong consensus for D (83% of answers), with upvoted comments emphasizing that views maintain data freshness, while tables do not automatically update.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
A business analyst needs to create a persistent data object named sales_by_employee that automatically updates when new data is inserted into the sales table. The object must contain two columns: sales_person (the employee's name from the employees table) and sales (the aggregated sales for that employee). The sales and employees tables can be joined using their common employee_id column.
Which of the following code blocks will achieve this?
A
B
No comments yet.