Oracle & SQL Server: COUNT(*) vs. COUNT(1) vs. COUNT(ColumnName) – Differences

NULL's will be eliminated! When doing a count() operation, it helps to understand what is counted and what is not. Count can be done in multiple ways COUNT(*) COUNT(1) COUNT([Column_Name]) COUNT(DISTNCT [Column_Name]) With and without GROUP BY While it is straight-forward to get a count, here are a couple of things to note NULL values … Continue reading Oracle & SQL Server: COUNT(*) vs. COUNT(1) vs. COUNT(ColumnName) – Differences

Advertisements

Oracle – Explain Plan Basics & Brief History

Whenever a SQL statement is submitted to the database server (be it Oracle or SQL Server), the server generates an execution plan which it uses to get the data in a well-defined order. The engine that does this work is called the “optimizer”. History of optimizers: RBO – Rule based optimizer Back in the day, … Continue reading Oracle – Explain Plan Basics & Brief History

Oracle – LAG & LEAD – Usage Examples + Interesting Use-case

LAG and LEAD are a couple of analytic functions that come in handy in some interesting situations. I am not really sure why I wrote this post but at least it gives you a a few queries to play with LEAD and LAG. I am not completely happy with how this post turned out. Nothing … Continue reading Oracle – LAG & LEAD – Usage Examples + Interesting Use-case