SQL SERVER – Using RANKING Functions Instead of SQL Looping Logic of Cursor – Quiz – Puzzle – 8 of 31

SQL Server Interview Questions and Answers
Print Book Available (207 Pages) | Sample Chapters

Year 2011 was a year of learning and opportunity for me. My recent book, SQL Server Interview Questions and Answers, has received such overwhelming love and support from all of you. While writing the book, I had two simple goals: (1) Master the Basics and (2) Ignite Learning. There was a constant request from the Community to take the learning of these books to the next level. Here is an article which discusses the Author’s Perspective.

Beyond Relational has come up with a very interesting concept – they have converted a few of the questions from my book into the SQL Quiz. The quiz is indeed focused on my two goals. In addition, it’s going to put the learning of the book to a higher stage. Looking at this novel concept, Vinod Kumar (Co-author) and I have decided to help every participant and reader by giving a few hints and suggestions to solve the quiz.

SQL Quiz

An SQL developer got surprised when he learned that he does not have to use cursors to calculate ranks in SQL Server 2008. He can now just use the newly introduced ranking functions. What are the different RANKING functions inside SQL Server 2008 R2 and what are the new functions introduced inside SQL Server 2012?

Link to participate in SQL Quiz

Notes of Vinod Kumar

This is a give away as a hint. But there are specific differences when it comes to each of these. Can you think of a scenario to use each of them effectively? Hint: Just think of a school and you will find ways of using them. :)

Notes of Pinal Dave

I still remember my first manager and his advice: “Take a walk, when you have to use cursor”. I still remember this and follow it every single time; I just have to use cursor. Cursors are not always bad, but if it is used without proper understanding and without considering other alternatives, it is indeed a bad decision to use. I have often seen cases where there were alternate ready-made solutions available, but still the developer went ahead and implemented a cursor that was not optimized (hogging resources). I personally insist on always learning all the new features of SQL Server as I often figure out alternative of cursors when I am exploring new features.

Additional Notes

SQL Server Interview Questions and Answers ISBN: 1466405643 Page#128-129
Use INSERT INTO … SELECT instead of Cursor
Simple Use of Cursor to Print All Stored Procedures of Database
Simple Use of Cursor to Print All Stored Procedures of Database Including Schema
Simple Example of Cursor
Cursor to Kill All Process in Database

Prize

There are exciting prizes awaiting the winners. Click here for Prizes and Frequently Asked Questions.

Link to participate in SQL Quiz

Note: The SQL Quiz, winners and prizes are administrated by Beyond Relational. The goal of this blog post is to provide additional learning pointers only.

Reference: Pinal Dave (http://blog.sqlauthority.com)

About these ads

One thought on “SQL SERVER – Using RANKING Functions Instead of SQL Looping Logic of Cursor – Quiz – Puzzle – 8 of 31

  1. Pingback: SQL SERVER – Weekly Series – Memory Lane – #011 « SQL Server Journey with SQL Authority

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s