Monday, February 8, 2010

SQL Server cube operator interview questions

Explain how to use Cube operator to summarize data.

Answer
A Cube operator summarizes data of group by. It helps in determining subtotals and grand totals.

Example: This will display a summary of employees with same first name.

Select first_name, last_name, AVG(salary) FROM employee GROUP BY first_name WITH CUBE

No comments:

Post a Comment