Geek Logbook

Tech sea log book

Leveraging SQL Window Functions with PARTITION BY

SQL window functions are a powerful tool for performing calculations across a set of rows related to the current row. When combined with the PARTITION BY clause, these functions can provide deep insights into your data by breaking it into partitions, allowing you to perform calculations within each partition separately. In this post, we will

Extracting Substrings from Strings in SQL Server

When working with SQL Server databases, you may often encounter scenarios where you need to extract specific parts of a string based on a pattern. A common requirement is to retrieve the substring that follows the last underscore (_) in a given string. This blog post will demonstrate how to achieve this using SQL Server

Common table expressions

Specifies a temporary named result set, known as a common table expression (CTE). Microsoft Documentation Although there are some time around us the first time someone asked me about it I was confused: I haven’t know its proper definition until that momento. In fact, the common table expressions where added to the SQL standard in

Know your String Connection using SQL

I was looking how to know my server on the internet, and I’ve found this interesting question in Stackoverflow: How to get the connection String from a database. And one question give us an example of how do it using SQL: And it Works properly: