Calculating product of values in a column in SQL and its business usecase

SQL supports most aggregate functions except one fundamental aggregation to calculate product of values in a column. If you are wondering what could be a scenario where you may have to calculate product of values in a column, here is a business scenario that demands it. Business Scenario: For the sake of brevity, let's say... Continue Reading →

Complement Negation: SQL Design Pattern to solve a frequently occurring interesting business data analysis problem

Here is an interesting business data analysis problem that I have come across multiple times in the recent times. Since I have seen this problem surfacing multiple times and the solution boils down to the same technique, it becomes an SQL Design Pattern and I named this baby as "Complement Negation". Have shared the justification... Continue Reading →

Single T-SQL query to swapping the values of two columns without using temporary column

How to swap the values of two columns of a table ? Let me explain the scenario with an example - Let's create a table named "Employees" with columns "First_Name" and "Last_Name". Then populate the table with some fictitious data. Then view the results once and then interchange the values in the "First_Name" and "Last_Name" columns... Continue Reading →

Up ↑

%d bloggers like this: