Getting the Minimum or Maximum of One Column

By the title of this post, you’re thinking “Ho hum. Sherpa will tell us about the stupid MIN and MAX functions in Snowflake and how great they are.” Well, they are great. Let’s not kid ourselves about that one. SELECT department_id, MIN(employee_id) AS FirstEmp FROM public.employees GROUP BY department_id ORDER BY department_id; This simply tells…… Continue reading Getting the Minimum or Maximum of One Column

Computing New Columns in Snowflake for fun and profit

SQL Server Calculated Column

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