We can manage our warehouse within our workspace by using SQL endpoint. In this test, we will write a SQL statement that calculates the total sales amount by month. We’ll then save this statement as a view in our SQL endpoint (Warehouse). This will allow us to easily access the total sales amount by month in the future.
1. Under your workspace, navigate to SQL endpoint TestLH
2. On the Home tab, select New SQL query.
3. In the query editor, copy and paste or type the SQL query below to calculate the total sales amount by month number in descending order. Once entered, select Run to view results.
SELECT MONTH(DateKey) AS "MonthNumber", SUM(SalesAmount) AS "TotalSalesAmount" FROM FactOnlineSales GROUP BY MONTH(DateKey)
4. Double click in “SQL query 1” to rename it as “TotalSalesAmount”
5. Highlight the full query text and select Save as view.
6. In the Save as view window, set the View name to TotalSalesByMonth and then select OK.
7. In the Explorer, expand the Views section and select TotalSalesByMonth to view the results in the Data preview.
8. Now, you can continue to write your SQL queries and explore the SQL endpoint editor.