T-SQL Notebooks in Fabric – Run Queries, Visualize Data & Save Views | Microsoft Fabric Tutorial

T-SQL Notebooks in Fabric – Run Queries, Visualize Data & Save Views | Microsoft Fabric Tutorial

T-SQL Notebooks in Fabric – Run Queries, Visualize Data & Save Views

Microsoft Fabric now supports T-SQL Notebooks — a powerful, interactive workspace for data engineers, SQL developers, and analysts to write, execute, and visualize T-SQL code with documentation and rich outputs.

๐Ÿ“Œ Key Features of T-SQL Notebooks

  • Write and run T-SQL code directly in notebook cells
  • Connect to Warehouses or SQL analytics endpoints
  • Visualize results using built-in charts and column profiling
  • Save SQL queries as Views
  • Supports cross-warehouse querying with 3-part naming
  • Schedule notebooks and use them in pipelines

๐Ÿงฑ Step 1: Add Warehouse as Data Source

  • Click + Data sources in the notebook toolbar
  • Select your desired Warehouse or SQL analytics endpoint
  • Set one as the Primary source

๐Ÿงช Example Queries

-- Query top records from a table
SELECT TOP 5 * FROM TechDWH.dbo.Customers;

๐Ÿ’ก Code Templates

Right-click a table in Object Explorer to generate SQL templates:

  • SELECT Top 100
  • Create Table
  • Drop Table
  • CTAS (Create Table As Select)

๐Ÿ’พ Save Query as View

Write your query and highlight it, then click “Save as View” in the toolbar:

SELECT * FROM TechDWH.dbo.Orders
WHERE OrderAmount > 1000;

๐Ÿ”— Cross-Warehouse Queries

SELECT * FROM SalesDW.dbo.SalesCustomer;

Use three-part naming convention: Database.Schema.Table

๐Ÿ“Š Visualizing Query Results

  • After query execution, go to the Inspect tab
  • Explore data distribution and column stats
  • Switch to charts (bar, pie, etc.) for quick insights
SELECT TOP 100 CustomerID, FirstName, LastName, Country FROM TechDWH.dbo.Customers;

๐ŸŽฌ Watch the Full Tutorial

Blog post written with the help of ChatGPT.