Tag Archives: SQL Community

Windows Functions; Who Knew?

CollaborateImage

SQL windows functions, it would seem, get lost in the shuffle most of the time when dealing with SQL. Why do you think that is? I honestly think that it is more or less developers, DBA’s, and data professionals are oblivious to some of the cool features that can be accomplished with its utilization. To put it simply windows functions could be viewed as looking in “windows” of your data. That is about as simple as an explanation as I received when I first started using these types of functions.

Example

Take the below table structure that I created on my local environment in SQL. My table name I created is called CustomerLog within that table I have two columns CustomerFirstName and CustomerLastName (represented below):

CustomerLog

For example(s) sake lets say I have a vast amount of data in this customer table and I want to partition it out and view just how many (categories) or windows I am looking at. This is where the windows function comes in nicely. With the below query I can find the results I am looking for pretty quick and easy:

Code

As you can garner with the above SQL windows function code you can derive how many customers share the same first letter in their name (result set below)

CustomerLogResult

Bottom Line

As you go through the SQL journey note that with any aggregate function being used you can turn that into a windows function by utilizing the over clause. You can only use windows functions though within the select or order by clause. This example only showed you how to partition using windows functions and only scratched the surface. It would behoove you to do some more research on what all you can do with SQL and window functions. Also, while you are at it; check out some of my colleagues as well

Mickey Stuewe: A Date At The End of The Month

Jeffrey Verheul: Write readable and high-performance queries with Window Functions

Julie Koesmarno: ABC Classification With SQL Server Window Function

Don’t sell yourself short. I guarantee once you start utilizing windows functions  you will want to use them everywhere. Just make sure you know the positives and negatives and as always just don’t blindly copy code from the net. Explore it, set something up on your Dev or VM sandbox. Failure to learn is not an option!

 

Success Is Journey Not A……

I’ve ofSuccess or Failureten heard the quote “Success is not a journey, but a destination”. Over the course of the last few weeks that quote has taken on a life like form in many fashions. To name a few things that have come to light to make this quote a very real thing are the MCM retiring, having a VMAX overloaded by maintenance plans across the board, upcoming DR Testing, planned Power outages (better than non planned ones eh!).

All these things as I look back on them screams to me that Success is a journey, not a destination. For SQL Data Professionals our jobs are ever changing and growing as we grow with it. Each day is an opportunity to learn something within SQL that you or I didn’t know yesterday, each day presents it’s own opportunities to reach resolutions that you or I didn’t know yesterday, and each day represents that during our failures we can discover the true desire for success.

To the beginner who is starting out who doesn’t know about the sp_configure, the proper use of ORDER BY, or what Table Scan vs. Indexing; the answer is not to just ignore or give up. Dig in and discover what that solution is; it’s how we learn.

To the seasoned SQL Data Professional vet who has been putting off getting on the speaking circuit, taking a newbie under your wing and mentoring them, or simply are just comfortable; challenge yourself. Step outside that normal box and tackle new things head on.

When you have that replication issue that goes awry and you don’t have that big enough wrench to fix it (I use this analogy all the time thanks to Robert Davis a.k.a. SQLSoldier (B|T), stay the course and work your way through it.

I get asked a lot of questions when speaking, email traffic etc., where individuals feel defeated in the problems they are facing within SQL. Every problem has a solution; every solution is waiting to be found it’s up to us as SQL Data Professionals to buckle down and find the answer.

If you are not active in the community I’ve listed some of what I call top tier SQL Data Professionals on the right of this blog site that I follow who have helped me in my DBA career. Forums are also a great place to increase ones learning…to name a few you can check out these:

One last note; when is the last time you just said a simple thanks to someone who has helped you in your career? This past week that has weighed on my mind greatly. A former boss, a mentor, a person who you get newsfeeds from…..I fall in the boat where I get wrapped up in the work I do; I often overlook the simple thank you that in reality goes a long way.

Tackle obstacles, Tackle your fears, and Tackle the solution head one.

Who Do I Follow? Where Do I Go?

There are many helpful sites within the SQL Community and several more blog sites that I follow. My favorites are noted on this site; however one that keeps drawing me back time and time again is by Brent Ozar’s group. For those of you who have not had the opportunity to check the site out I’ll lay out some real world specifics on what has helped me and how I have benefited from such sites as this one.

The Webcast’s

Every Tuesday I usually find my way to their 30 minute webcast for treating pain points within SQL (among other topics). At the end of each web cast, if time permits, they will host a quick question and answer session over the topic to viewers. Check out future webcast’s here

Two Important Free Tools

There are two scripts that have seemed to help me tremendously over the course of the year. One is sp_Blitz (comes with a SSMS custom report) which a new version just came out; and the other is sp_BlitzIndex. I recently just started to use the sp_BlitzIndex but I liking this little utility while the other sp_Blitz I use when hitting new or old servers, you know the ones that you stumble upon that no one knows about and no one has a clue of what it is doing. Two great free utilities that are offered that may just save your hide one day.

Popular Topics

I like the fact that on the site they keep a section for Popular Topics that are happening within the industry; keeps me up to date and provides insight on some of the issues I experience on a daily basis. Some topics you may find:

The Team

The team makeup of Brent, Kendra, Jeremiah, and Jes makes it an easy choice for me to have in my arsenal of following. I try to find people in the industry of whom I consider for myself top in the industry and learn from them and their techniques to help better myself and further gain more knowledge.

Check it out

If you haven’t already done so go check their site out and what their about. Real people providing real solutions with some fun along the way.

The Roundup – #TSQL2sday

Another T-SQL Tuesday has come and gone and I’ve got to admit that all the responses that were received are pretty awesome and even had a few responses from first timers that attended the PASS Summit 2012. While all the posts were great, I had one that blew me away and is exactly what the Community is about. Kendal Van Dyke allowed a post to be tied to his blog by Andy Levy who currently didn’t have a blog and is fairly new to SQL. If you get a chance check it out.

One theme that I read over and over again is that we are one huge family and we have each others backs. The Community has a whole goes out of their way to assist our fellow members. Below is the roundup from everyone who chimed in. Thanks everyone for their participation!

Remember if you are interested in hosting please contact Adam Machanic (B|T)

POSTS

Jason BrimHall – SQL Family – After Summit 2012 | SQL RNNR

Rob Farley – Rob Farley : SQL Community – stronger than ever

Aaron Bertrand – T-SQL Tuesday : Reflections on the PASS Summit and our community

Robert Davis – T-SQL Tuesday #36 – SQL Community | SQLSoldier

Chris Shaw – Esprit de Corps T-SQL Tuesday #36 « Chris Shaw’s Weblog

Valentino Vranken – BI: Beer Intelligence? · PASS Summit 2012: Impressions Of A First Timer

Steve Jones – T-SQL Tuesday #36 – What Does Community Mean? « Voice of the DBA

Oliver Asmus – T-SQL Tuesday #36 – What Does the SQL Community Mean To You? | OliverAsmus.com

Edwin Sarmiento – PASS Summit and The Value Of Building A Community

Wayne Sheffield – T-SQL Tuesday #36 – Community

Mike Fal – T-SQL Tuesday #36 (#tsql2sday) – Coolness factor | Art of the DBA

Robert Pearl – TSQL Tuesday – What SQL Community Means To Me

Tamera Clark – SQL Community and Family

Kendal Van Dyke (On Behalf of Andy Levy) – T-SQL Tuesday #36 – SQL Community (Guest Post)

Kerry Tyler – T-SQL Tuesday #36: What Does the SQL Community Mean to You (Me)?

Argenis Fernandez – T-SQL Tuesday #36 (#tsql2sday)– Post-PASS Summit Depression

SQL Asylum – T-SQL Tuesday #36 SQL Community how you can get involved

Dev Jef: – T-SQL TuesDay #36 – What does the community mean to you? « SQL from the Trenches

Mickey Stuewe – T-SQL Tuesday #36 – What Community Means to a Newbie « Mickey’s T-SQL Ponderings

David Maxwell – T-SQL Tuesday #36: What Community Means To Me | David Maxwell on SQL Server

Stacia Misner – Data Inspirations » We are (SQL) Family! (T-SQL Tuesday #36)

Jenny Salvo – T-SQL Tuesday: What Does the SQL Community Mean to You? | Salvo(z)