One of the many things that the business team asks me to do is to create random-ish data. Thankfully, in Snowflake, there are many ways to make this happen. Today, I want to go thru just a few of them. Perhaps the one that most people are familiar with is making Snowflake create a random…… Continue reading Creating Random Data in Snowflake
Cleaning Up Your Data the Easy Way in Snowflake
I don’t know about y’all but I have to work with dirty data. A lot. When you’re working with dirty data, one of the many things you can run into is that when you try to divide two numbers – you can cause a huge error because you tried to perform a mathematical no-no -…… Continue reading Cleaning Up Your Data the Easy Way in Snowflake
Computing New Columns in Snowflake for fun and profit
Sometimes to make our lives easier, we, as database engineers, can create a table that automatically tells us the answer as we need it – or at least how we tell it we want it. In SQL Server, we create what is called “Computed Columns.” DROP TABLE IF EXISTS dbo.Payroll; GO CREATE TABLE dbo.Payroll (…… Continue reading Computing New Columns in Snowflake for fun and profit
Where We’re Going, We Don’t Need Limits
There is always a lot of fun things you can learn to do with Snowflake. Sometimes they’re even in the places you least expect to find anything even slightly different. Take for example LIMIT. SELECT * FROM public.employees LIMIT 20; Most of us have written the statement above – or something like it – a…… Continue reading Where We’re Going, We Don’t Need Limits
Desperately Seeking Connections by Joining with Snowflake
Today, I want to talk about that fun edge case when you’re having to join a table to itself in Snowflake. Does it happen often? Not unless your architect just hates you. Let’s use the normal pieces of data that everyone uses for this kind of thing – employee/manager relationships. We have our employee table…… Continue reading Desperately Seeking Connections by Joining with Snowflake
Finding a Percentage of Rows from a Table
In our last post, we went over one way to get a sample of data. In the end was it right? Heck, no – at least not if we wanted a percentage of rows returned. Now, SAMPLE does work fine if you want a specific number of random rows returned each time. But, let’s face…… Continue reading Finding a Percentage of Rows from a Table
Questioning the Top Results in Snowflake
One of the things you may have noticed after reading our last post on Top (found here) is that sometimes SAMPLE doesn’t give the answer you want. For example, we can run the same query to get 20% of the table. Remember that this table has 290 rows in total. As you can see on…… Continue reading Questioning the Top Results in Snowflake
Having Great Fun with Top in Snowflake
One of the items that we’re asked to do as data professionals is to only take the first few hundred rows from a table. Heck, it’s important enough that I’ve actually already talked about it in SQL Server here and a few other places also listed in that article. I’m sure you’re asking yourself “Sherpa,…… Continue reading Having Great Fun with Top in Snowflake
Watching Our Changes in Snowflake
For those of you who have seen me speak at an event for SQL Server, you have probably seen my Windowing Functions presentation. (If not, you should – it could be life-changing!) If you’ve ever had the pleasure of working with the row_number function in SQL Server, you will enjoy working with it in Snowflake.…… Continue reading Watching Our Changes in Snowflake
Checking if your XML is actually well-formed
Sometimes you’ll find that you will have XML in your database. This could be for various reasons – from storing the XML after receiving an API response to keeping it in a table because a web developer couldn’t figure out another way to store their data. Sometimes – no matter how much you trust your…… Continue reading Checking if your XML is actually well-formed