I’ve recently started working on a project where we working in the cloud with Azure SQL Data Warehouse:
“Azure SQL Data Warehouse is a cloud-based, scale-out database capable of processing massive volumes of data, both relational and non-relational”
For more information about Azure SQL Data Warehouse, see here.
Although we develop with the same T-SQL as we do using the on-prem version of SQL Server, I did come across a bit of a quirk when writing some update statements.
If we are using the on-prem version of SQL Server, when we need to update data, we would have a SQL query like:
That is a basic update to a specific row of data in the Sales.MyOrderDetails table, using a where clause to filter for the row.
Sometimes, it isn’t always as straight forward and we need to join to other tables, so that we can refer to attributes from those rows for filtering purposes. For example:
However, if we take this approach in SQL Data Warehouse, we get the following error.
SQL Data Warehouse doesn’t support ANSI joins in the FROM clause of an UPDATE statement (it is also the case for DELETE statements too). There is a way round it and it uses an implicit join.
Before we look at how the update query can be written, it is a good place to point out that Inner joins can be written in a couple of different ways to what we had above.
In an inner join, the ON and WHERE clause both perform the same filtering and they both return rows where the ON and WHERE predicate is true. Therefore, we could write an inner join as
or implicitly like,
However, it is normally best to stick with the original example rather than the implicit version as although it is still supported, it is an old deprecated syntax and not considered best practise.
So, in order to write an update query in SQL Data Warehouse that uses inner joins to filter the rows, the workaround is as follows:
In conclusion, most SQL statements written in Azure SQL Data Warehouse are written in the same way we would with he on-prem version of SQL Server, however, there are some cases where the syntax differs slightly and I will be blogging more about these special cases as I come across them!
Pareto Charts in Power BI and the DAX behind them
The Pareto principle, commonly referred to as the 80/20 rule, is a concept of prioritisation.
Apr
Databricks: Cluster Configuration
Databricks, a cloud-based platform for data engineering, offers several tools that can be used to
Apr
AI Assistance in Microsoft Fabric
The exponential growth of Large Language Models (LLMs) couples with Microsoft’s close partnership with OpenAI
Apr
10 reasons why it’s worth the effort to understand the value of your data
“If leaders really want to create a data driven culture, the journey starts with them!
Apr
Content Safety in Azure AI Studio
Azure AI Content Safety is a solution designed to identify harmful content, whether generated by
Apr
Model Benchmarks in Azure AI Studio
In the constantly changing field of artificial intelligence (AI) and machine learning (ML), choosing the
Apr
Celebrating International Women’s Day: from Classroom to Code
As we celebrate International Women’s Day, I want to share my journey of breaking stereotypes
Mar
Pretty Power BI – Adding Pagination to Bar Charts
Good User Experience (UX) design is crucial in enabling stakeholders to maximise the insights that
Feb