Calculating Running Total with OVER Clause and PARTITION BY Clause in SQL Server
You often come across scenarios where you have to calculate a running total of a quantity. A...
Creating Dynamic Pivot Table with QUOTENAME Function
In my previous article on the basic pivot operator, we saw how pivot operator could be used to convert rows to columns, resulting in pivot...
Methods to Rank Rows in SQL Server: ROW_NUMBER(), RANK(), DENSE_RANK() and NTILE()
SQL Server provides us with a number of window functions that help us to perform calculations across a set of rows, without the need to...
Understanding Pivot Operator in SQL
The pivot operator in SQL Server converts each row in the aggregated result set into corresponding...
Query Optimization in PostgreSQL. EXPLAIN Basics – Part 2
In my previous article, we started to describe the basics of the EXPLAIN command and analyzed what happens in PostgreSQL when executing a...
Query Optimization in PostgreSQL. EXPLAIN Basics – Part 1
Why does it take so much time to execute a query? Why are there no indexes? Chances are you’ve heard about EXPLAIN in PostgreSQL....
Oracle Regular Expressions. Dangerous Range
An Oracle developer who often uses regular expressions in code sooner or later can face a...
Eliminating Duplication of Where Expressions in Application
Assume you have products and categories. A client says that it is necessary to use other business processes for the categories with the...
Better ALTER than DROP
In this article, I am going to provide a construction for deleting an object before creating it....
What Can Query Plan Tell?
Introduction SQL query describes the expected result, not the way to get the result. The set of...



