(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

How to query a Lakehouse with the SQL analytics endpoint

João Barros 04 de July de 2026 4 min read

The SQL analytics endpoint is the fastest way to query the Delta tables of a Lakehouse in Microsoft Fabric without writing a single line of Spark code. Whenever you create a Lakehouse, Fabric automatically provisions this endpoint, which exposes your tables as a database ready to receive read-only T-SQL queries. If you already know SQL, it is the most natural bridge into working with a Lakehouse.

Prerequisites

  • A Microsoft Fabric workspace with active capacity (a free trial works).
  • A Lakehouse already created, with at least one Delta table loaded.
  • Basic SQL knowledge: SELECT, WHERE and GROUP BY.

Step 1: Open the SQL analytics endpoint

Go to your workspace and find the Lakehouse. Next to it, Fabric shows an item with the same name but of type SQL analytics endpoint. Click that item to open the query editor. If you are already inside the Lakehouse, there is an even faster shortcut: use the mode switcher in the top-right corner and change from Lakehouse to SQL analytics endpoint.

On the left you will see the list of Delta tables. It is the same information as the Lakehouse Explorer, but now organized as a database schema that accepts T-SQL. There is nothing to configure: the endpoint is ready to go.

Step 2: Write your first query

At the top of the editor, click New SQL query. To query a Lakehouse, start by peeking at the first rows of a table. Replace vendas with the name of your table:

SELECT TOP (100) *
FROM vendas;

Click Run (or press Ctrl+Enter) and the results appear below. Using TOP (100) is a good habit while exploring: it avoids pulling millions of rows at once.

If you get the Invalid object name error, check the table name. Lakehouse tables live in the dbo schema by default, so dbo.vendas is also valid.

Step 3: Filter and aggregate data

Querying everything is rarely the goal. The usual approach is to filter with WHERE and summarize with GROUP BY. The following example counts the sales and sums the total per country, for the year 2025 only:

SELECT
    pais,
    COUNT(*)      AS numero_vendas,
    SUM(valor)     AS total_vendas
FROM vendas
WHERE YEAR(data_venda) = 2025
GROUP BY pais
ORDER BY total_vendas DESC;

The SQL analytics endpoint speaks the same T-SQL as SQL Server and the Fabric Warehouse, so functions such as YEAR(), SUM() and COUNT() are all available.

Step 4: Join two tables with a JOIN

Because the endpoint understands full T-SQL, you can combine several Delta tables in a single query. Imagine a vendas table and a clientes table linked by the cliente_id column:

SELECT
    c.nome        AS cliente,
    SUM(v.valor)  AS total_gasto
FROM vendas AS v
INNER JOIN clientes AS c
    ON v.cliente_id = c.cliente_id
GROUP BY c.nome
ORDER BY total_gasto DESC;

Tip: always give each table a short alias (v, c). It makes the query easier to read and avoids ambiguity when two tables have columns with the same name.

Step 5: Save the query as a view

When a query becomes useful, turn it into a view so you can reuse it. Note one important detail: the Delta table data is read-only here, but you can create SQL objects such as views, functions and procedures.

CREATE VIEW vendas_por_pais_2025 AS
SELECT
    pais,
    SUM(valor) AS total_vendas
FROM vendas
WHERE YEAR(data_venda) = 2025
GROUP BY pais;

From now on, anyone with access can run SELECT * FROM vendas_por_pais_2025 without rewriting the logic. Views are also an excellent foundation for building Power BI semantic models.

Verify the result

To confirm everything worked, run a simple query against the new view:

SELECT * FROM vendas_por_pais_2025
ORDER BY total_vendas DESC;

If you see one row per country with the matching total, your view is working. Also check that it appears in the Views folder in the object tree on the left.

Conclusion

You now know how to open the SQL analytics endpoint, write SELECT queries, filter and aggregate data, join tables with JOIN and save the logic in a reusable view — all without leaving Microsoft Fabric. Keep this golden rule in mind: the endpoint is read-only, so to insert or change data, go back to the Lakehouse and use Spark or a pipeline. What will be the first view you create over your own data?