Tag: Oracle SQL
-
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…
-
A Use Case of CROSS JOINS in SQL
Use case of SQL CROSS JOIN: Although CROSS JOIN is available in SQL, you rarely find any instance where you can use it. Here is one use case for CROSS JOIN in SQL: Example with fictitious data: Assuming a tournament of Soccer to happen among four teams, what are the…
-
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…
-
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…