Recently, a friend of mine asked me about the best way to find loops in a hierarchy, specifically with Active Directory groups that may be nested (either by design or by mistake) thereby causing loops and this recursion based solution was my recommended answer for him. The Problem: Here is the example he gave me: … Continue reading PowerShell: Recursion And Finding Loops In A Hierarchy With Active Directory Example
SQL Server: MERGE (AKA UPSERT) =(INSERT / UPDATE / DELETE) – All In One
MERGE statement does INSERT/UPDATE/DELETE For the longest time Oracle and SQL Server users have written code like this (pseudo code) This is great but this is such a common construct that everyone has also been long craving for built in support in the database for what people commonly call UPSERT (UPDATE if key exists else INSERT). … Continue reading SQL Server: MERGE (AKA UPSERT) =(INSERT / UPDATE / DELETE) – All In One
Oracle – Back To The Past – Using The Oracle Flashback Query Feature
Go back in time and look how something looked then - Isn’t this one of those things that is really cool? In Oracle, the set of features that enable this capability are clumped under “Oracle Flashback Features”. Technically, they can be bucketed as: Flashback query – as the name means, retrieve data as of a point … Continue reading Oracle – Back To The Past – Using The Oracle Flashback Query Feature
Oracle and SQL Server – Conditions In WHERE Clause vs. JOIN Clause – Why And When It Matters? Must Read!
This post is about the various types of JOIN's and how the conditions affect the results when placed in the JOIN clause versus the WHERE clause. OUTER JOINS Database programmers use OUTER JOINS in their job day in and day out. There are certain “gotchas” that you need to watch out for. One not only … Continue reading Oracle and SQL Server – Conditions In WHERE Clause vs. JOIN Clause – Why And When It Matters? Must Read!
Oracle/SQL Server – RANK, DENSE_RANK and ROW_NUMBER Analytic Functions – Basic Examples
Note: The illustrations on this post are done with Oracle. However, by making minor changes, you should be able to run it on SQL Server and the concepts remain the same. Please refer this post for changes needed. RANK, DENSE_RANK and ROW_NUMBER are three powerful analytic functions that every database developer should be thoroughly familiar … Continue reading Oracle/SQL Server – RANK, DENSE_RANK and ROW_NUMBER Analytic Functions – Basic Examples