SQL – Deleting duplicate rows using ROW_NUMBER()

So your database is/was designed in a way that exact duplicate records could be inserted with no way to uniquely identify each row. Now that you need to delete duplicate rows you can do one of two things: Schema: Solution 1: One way to do this is by inserting the data into a temp table, …

Continue reading SQL – Deleting duplicate rows using ROW_NUMBER()

Using LEAD and LAG in your SQL queries

So you need to show some sales data. You are then asked that the quarters you are returning in the query need to show the previous and next quarter's sales data in the same row. This is easily handled by using the built-in SQL server functions LEAD and LAG. Setting up the schema and sample …

Continue reading Using LEAD and LAG in your SQL queries

Generating a PEM private and public certificate with OpenSSL on Windows

To generate a PEM certificate using OpenSSL is easy, but if you haven't yet done it before it can be a bit frustrating if you've never used OpenSSL before. If you think you can just go to OpenSSL.org and download the binaries you are mistaken. They only provided source files which you need to compile. …

Continue reading Generating a PEM private and public certificate with OpenSSL on Windows