This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
In this blog, we'll focus on the different ways of querying data in Synapse Real-Time Analytics. But before we begin, make sure to follow the steps in the Synapse Real-Time Analytics: Discovering the best ways to get data into a KQL database to ingest data into your KQL database.
We recently launched Microsoft Fabric - an all-in-one analytics solution for enterprises that covers everything from data movement to data science, real-time analytics, and business intelligence. Microsoft Fabric brings together new and existing components from Power BI, Azure Synapse, and Azure Data Explorer into a single integrated environment. The platform is built on a foundation of Software as a Service (SaaS), which takes simplicity and integration to a whole new level.
One of Fabric’s key components is Synapse Real-Time Analytics, a fully managed big data analytics platform optimized for streaming and time-series data. It provides all the amazing query capabilities, performance, and scale that customers are used to with Azure Synapse Data Explorer in a SaaSified experience.
The main items available in Real-Time Analytics include:
Get_started_with_exploring_your_data_with_KQL_a_purpose-built_tool_for_petabyte
Description automatically generated">
The ‘Query table’ context menu provides some sample SQL queries. You can bring your SQL skills to query data in your KQL database.
Get_started_with_exploring_your_data_with_KQL_a_purpose-built_tool_for_petabyte
Description automatically generated">
Get_started_with_exploring_your_data_with_KQL_a_purpose-built_tool_for_petabyte
Description automatically generated with medium confidence">
StocksDaily
| summarize count() by Ticker
In this query, we use the summarize operator and the count() function. Similar to SQL, KQL provides many standard scalar functions.
2. Find the years with the largest change for ATVI stock ticker:StocksDaily
| where Ticker == "ATVI"
| summarize max(Close), min(Close) by startofyear(Date)
| extend pct = round((max_Close - min_Close)/ min_Close *100,2)
| sort by pct
In this query, we use the extend operator to create a calculated column and then the sort operator to sort the result set.
3. Render a timechart of the closing price of GSPC stock ticker:StocksDaily
| where Ticker == "^GSPC"
| project Close, Date
| sort by Date asc
| render timechart
In this query, we use the project operator to select the columns of interest in the result set. And then, we use the render operator to show a timechart of the result set.
4. Find the day when stock market crashed:StocksDaily
| where Ticker == "^GSPC"
| serialize
| extend prevClose = prev(Close,1)
| extend pct = round((prevClose - Close)/ Close *100,2)
| top 10 by pct
| project Date, pct
| render scatterchart
In this query, we use the serialize operator to serialize the output so that we can use prev() to calculate the difference between the current and previous values. KQL also provides the top operator that combines the function of sorting and showing only the specified number of records.
5. Find the stocks that had the largest fall in any given year:StocksDaily
| summarize max(Close), min(Close) by Ticker, startofyear(Date)
| extend pct = round((max_Close - min_Close)/ min_Close *100,2)
| sort by pct
In this query, we are combining summarize, project, and sort by operators with arithmetic calculations.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.