Microsoft Fabric Updates Blog

Introducing Copilot for SQL database in Microsoft Fabric

This last November, we announced the preview of SQL database in Microsoft Fabric. To mark this milestone, we published a blog post providing an in-depth look at the query editor and its core functionalities – Tour the Query Editor in SQL database in Microsoft Fabric. Query Editor is designed to enhance productivity in writing, editing, and executing SQL queries to interact with databases and simplify management tasks like performance optimization.

In this blog we’ll delve into the Copilot integration for Query Editor. We’ll start by getting a high-level understanding of what it is and why does it matter – Think of Copilot for SQL database in Fabric as an AI-powered assistant designed to support you regardless of your SQL expertise or role.

Here’s how Copilot can help:

  • Developers can ask natural language questions about their data to generate T-SQL queries or rely on Copilot to complete their code as they type.
  • Database administrators can optimize their queries or troubleshoot errors, with Copilot providing solutions and insights directly in response to error messages.
  • Citizen developers and business users can quickly grasp complex code with Copilot’s clear and concise inline explanations.

By leveraging your database schema, documentation, and other knowledge sources, Copilot delivers intelligent context-aware answers and assistance. No matter your role or expertise, Copilot makes working with SQL faster, easier, and more intuitive. Rest assured, your business data is secure Copilot features use Azure OpenAI Service, which is managed and secured by Microsoft. Your data isn’t used to train models and isn’t available to other customers.

Important note: Currently, some regions do not support Copilot for SQL databases in Fabric. However, efforts are underway to make this feature available across all Fabric region availability in January 2025.

Today, we are offering three key functionalities:

1. Chat Pane: Your Collaborative SQL Database Assistant

Open the sidecar chat from the ribbon to interact with Copilot using natural language. Whether you have a question or need a request fulfilled, Copilot provides context-aware responses by leveraging both your database schema and the history of your conversation.

A GIF showing a user clicking the Copilot button in the ribbon, which opens the Copilot chat pane.

This creates a seamless, multi-turn experience where Copilot acts as a collaborative partner, helping you navigate complex database challenges and offering step-by-step solutions. You can also use the chat pane to learn more about standard SQL, query processing, database management features, and best practices. The Chat pane currently supports two primary skills:

Skill #1 – Natural language to SQL conversion

Copilot can generate DML/DDL/DQL code based on user requests, enabling seamless data querying or object creation.

Sample prompts:

    • “Create a table called SalesTransactions with columns named CustomerID, ProductID, OrderDate, Quantity”
    • “Show customers who placed an order in 2023 and haven’t placed another since.”
    • “Rank employees by their sales performance in each region.”

A GIF demonstrating a user prompting the Copilot chat pane to create a table for storing employee data (including columns for EmployeeID, full name, and hire date). Copilot responds by generating the corresponding SQL query along with an explanation of its structure.

Users can iterate on the generated SQL until they are satisfied with the results, then insert and execute the code directly within the SQL text editor.

A GIF demonstrating a user asking Copilot to generate SQL code to display the top-selling product. The user then follows up with another related prompt, and Copilot responds using the context of the previous conversation. The user inserts the generated SQL code into a text editor and executes it directly from there.

To ensure that Copilot generates accurate results, be as specific as possible when crafting your prompts. Clearly describe the information you’re seeking, such as which columns you want to view, the types of aggregations needed, and any filtering criteria.

Skill #2 – Document-Based Insights

Ask Copilot questions about general SQL database capabilities, such as standard SQL language, query processing, and database management features, and copilot will provide an answer based on relevant Microsoft Learn documentation.

Sample prompts:

    • “What data types are available?”
    • “How does my database auto-scale?”
    • “How do I query from two or more tables?”

A GIF demonstrating a user asking Copilot about available data types, with Copilot providing a detailed response based on SQL Server documentation.

SQL Database in Fabric shares the same engine as Azure SQL Database, so most features are identical. Copilot currently references documentation from Azure SQL Database to provide answers to a wider range of questions. While we’re working to enhance Copilot’s intelligence and reference more knowledge sources, carefully review answers based on Azure SQL Database documentation for any potential differences. For a deeper comparison, read Features comparison: Azure SQL Database and SQL database (preview) Additionally, we are working to expand support for additional database management skills, enabling you to receive self-guided assistance in monitoring your database performance. This will allow you to ask Copilot questions that involve system tables or dynamic management views (DMVs) and help you solve issues independently. For example, you could ask Copilot: “Why is my database slow?” or “How can I tune this high CPU query?”

We’d love to hear which skills would be most valuable to you. Feel free to submit your feedback or upvote suggestions from others. For ideas, you can refer to Microsoft Copilot skills and Azure SQL Database (preview).

2. Inline Code Completion: Write Faster, Cleaner SQL

As you begin typing in the SQL text editor, Copilot generates real-time code suggestions to help you complete your code faster. This feature reduces the need to constantly switch between your editor and external resources like documentation or search engines. It also minimizes common syntax errors, leading to cleaner and more reliable code.

A GIF showing a user typing code to rank products by revenue generated, with Copilot actively autocompleting the code in real-time, suggesting the appropriate SQL syntax and logic.

Additionally, you can write a comment in plain text to inform Copilot about your request. Based on the comment, Copilot will generate a relevant code suggestion to assist you.

A GIF showing a user writing a comment starting with "--", stating that the code is intended to create a view with customer information and their total purchase amount. Copilot intelligently provides a complete code suggestion, aligning with the described functionality in the comment.

You can enable or disable this feature in the database settings under the ‘Show Copilot completions’ option.

A GIF showing a user clicking the "Copilot Completion: On" button at the bottom of the editor, which opens the database settings pane. The user navigates to the "Show Copilot Completions" toggle button within the pane and demonstrates turning the feature on and off.

3. Quick Actions: Fix and Understand Your Code with Ease

Within the SQL text editor toolbar, you’ll find two quick actions—’Fix query Error’ and ‘Explain query’—that can be used when you select a block of code.

  • Fix Code Error: This feature quickly identifies coding errors and suggests fixes, allowing you to maintain your workflow without interruption. It minimizes the risk of introducing new errors by providing fixes that are contextualized to your schema. A GIF showing a user running into an error message for a query that retrieves the SalesOrderID and the total quantity of each order, due to a column not being included in the GROUP BY clause. The user then clicks "Fix Query Error," and Copilot automatically corrects the code. Copilot also highlights the fix with a comment pointing out the specific change made.
  • Explain query: This feature provides clear, detailed explanations of complex code, making it an excellent learning tool for both new and experienced SQL users. It also promotes better communication and understanding within teams, enhancing collaboration. A GIF showing a user selecting a portion of a dynamic SQL query that generates the total sales for each product category in a specific year. The user then clicks the "Explain the Code" quick action, and Copilot provides a detailed explanation of the code in comment format, explaining each part of the query.

Accelerate Your Learning Journey with other Copilot across Microsoft Fabric

Reference the step-by-step tutorial that demonstrates an end-to-end scenario using an SQL database in Fabric, integrating with other Fabric workloads. The tutorial covers creating a database, setting up database objects, exploring autonomous features, and visualizing data.

While Copilot may not be explicitly mentioned in some sections, it’s available in many places to enhance and accelerate these steps.

Here’s how you can leverage Copilot while you follow this tutorial:

  • Data Ingestion with Data Factory: Use Copilot for Data Factory in Fabric to use natural language to articulate their requirements for creating solutions using data flows or data pipelines, create summaries, or troubleshoot error.
  • Data Analysis in Notebooks: Perform advanced data analysis in notebooks with the help of Copilot for Data Science and Data Engineering in Fabric, which provides insights on data and creates code for visualizations or data transformations.
  • Report Creation in Power BI: Create insightful reports using Copilot for Power BI, summarizing or turning your data into charts and actionable insights.

Getting started with Copilot for SQL database

Get started with Copilot for SQL database in Fabric today! Learn more about it using the resources below:

Related blog posts

Introducing Copilot for SQL database in Microsoft Fabric

June 17, 2025 by Dan Liu

Have you ever found yourself frustrated by inconsistent item creation? Maybe you’ve struggled to select the right workspace or folder when creating a new item or ended up with a cluttered workspace due to accidental item creation. We hear you—and we’re excited to introduce the new item creation experience in Fabric! This update is designed … Continue reading “Introducing new item creation experience in Fabric”

May 29, 2025 by Sukhwant kaur

Step into the future of simplicity with Fabric CLI. The Fabric Command Line Interface (CLI) has arrived in preview, bringing with it a seamless way to create SQL databases for your projects. This guide will take you through the steps to get started, ensuring you can leverage the power of Fabric CLI with ease. Prerequisites Before … Continue reading “How to create a SQL database in Fabric using Fabric CLI”