SQLServerCentral apologizes and you can win a book

  • kennethrbell (12/12/2013)


    Last evening I went to a Pacific NW SQL user group meeting. The guest speaker was Itzik Ben-Gan.

    Before that:

    I opened the “Apologies…” email last week from SQLServerCentral.com (very catchy title, by the way, as I only open 30-60% of these depending on personal bandwidth). I thought, “Hmmm, this name sounds familiar.” Sure enough, he was the speaker that I had just read about in the PNWSQL email, and the previous month’s presenter had spoken very highly of him. I had already planned on going, but maybe I could chat with him after the presentation and get an inside track on winning a new book. Possibly I could get an interesting quote to share with Steve Jones and all of the contributors and followers of the website.

    So then went into research mode. Who was Itzik? What was he about? What has he done? How could I appeal to him? I saw one of his other books on Amazon, Training Kit (Exam 70-461): Querying Microsoft SQL Server 2012. When I saw that one of the co-authors was Ron Talmage the president of PNWSQL, I bought it. What the heck, I’d been feeling it is time to update my certs from SQL 2000. I also felt that it would be better if I showed up with a book “in hand”. I could ask for an autograph after the presentation which could create the opportunity to ask Itzik about the “unintended plagiarism” on SQLServerCentral.com, the reaction by Steve Jones and the “win a book written by Itzik” offer.

    So I arrived at the presentation with high expectation. I was not disappointed. The title of the presentation was, “Creative Uses of the APPLY Operator.” The room was fairly packed. There were more people there than the prior three months combined.

    Itzik is an engaging and smooth presenter. He can manage the presentation devices, write code, present theory, and have it all make sense faster than I could take notes. He has the charisma of a movie star, a cool accent and the enthusiasm of a child at Christmas. The presentation reminded me of watching Roberto Benigni accepting his Oscar for Best Actor in his 1997 movie, Life Is Beautiful (look it up on YouTube.) I learned more in the first 10 minutes than I could process, and I had 65 minutes to go.

    By the way, the much easier way to go would have been to study his previous work. He gave out 8 or so books during the course of the evening. If I was better prepared, I could have answered a question correctly and wouldn’t have to write this essay.

    I may have been star struck.

    By the end of the presentation, I walked up to him. I actually opened my Amazon box in front of him. My comment was, “I brought my own book, would you sign it for me.” He was very accessible and charming. He wrote, “Happy Querying!” and signed my book.

    During this time, I asked him if he had heard about the kerfuffle on SQLServerCentral.com. He said he had, and had received an email from Steve Jones.

    Yet, I think I caught him off guard. I think he wanted questions about the “Apply Operator”. I said, “I was hoping for some words that I could use that would help me “cinch” the “win a book” contest. He responded enthusiastically, “use the code that I presented that included the sum(sum(val)), that is really good. That will earn you a free book.”

    Unfortunately, by that point in the presentation, I was already a page behind and had given up on copying and instead chose to enjoy the show.

    I tried one more probing question, “I was hoping for a quote.” Again, he gave me a curious look and politely said, “I’m drawing a blank.”

    I felt as though I had failed in my mission. I was hoping to have something interesting to quote, and I was even hoping to create a memorable moment. Yet, I started feeling as if I were being impolite and/or boorish. I was disappointed in my attempt and somewhat frustrated with myself.

    I turned to Ron Talmage to have him sign my book as well. I was juggling my Amazon box, SQL book, notepad and pen. Somehow the SQL book goes forcefully flying ten feet across the table and past Itzik. He reached over to pick up the book. As he hands it to me, he exuberantly quips, “Here’s a quote for you. Say that you tried to kill me with my own book.”

    So, I wish I had more of Itzik’s latest code to share with you (he offered), but I feel the time crunch of posting this to the forum.

    Here is some code that I use on my personal database project. Basically, I have a horseracing database that I use for research. It took me a while to figure out how to compare horses within each race. This code allows me to create a view from one of my tables. I can then query the view to look for the top ranked horse within a race. I also use it to compare previous similar races to an upcoming race and determine how “deep” I may need to go to find today’s winner. For example, in historical races like today’s first race 10 of the 12 winners were in the top 2 (or 6) ranked Prime Power.

    Steve, Thank you for the opportunity and space.

    Create View [dbo].[vL2RPrime] AS

    Select

    [Track]

    ,[Date]

    ,[Year]

    ,[Month]

    ,[Day]

    ,[Race#]

    ,[ProgramNumber]

    ,[PostPosition]

    ,[HorseName]

    ,[TodaysTrainer]

    ,[PrimePower]

    ,RANK() OVER

    (PARTITION BY (DTR) ORDER BY PrimePower DESC) AS RankPrime

    FROM vLSIV2ndWin

    That's a great story! I met him for the first time at SQL PASS 2012 in Seattle. I had never heard of him but saw that some of the T-SQL heavy weights/Old timers here talked about him all the time on their blog. I went to the session before his early to get a front row seat for his session. It was a great presentation.

    I have since read both of his SQL 2012 books cover to cover (which I suggest since they are really SQL 2012-and-before books; I work on 2008 R2 personally.) I read them all the time still; they are beat up and filled filled with notes/scribble. I have learned more about T-SQL reading his books/blog/articles (along with the blogs/articles/stairways/posts on SSC) and feel that I have learned more in the last two years then I did in the all the previous years combined. I am studying for the SQL Server 2012 Developer Exam and was delighted to see how Ben-Gan was one of the authors of the study guide.

    How could I appeal to him?

    Read his books, study the goldmine of free SQL learning which is SSC, sharpen your T-SQL skills and win a T-SQL Black Belt shirt. That's what I'm trying to do.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • very appreciated initiative .

    SELECT id, val,

    ROW_NUMBER() OVER(ORDER BY val) AS rownum,

    RANK() OVER(ORDER BY val) AS rnk,

    DENSE_RANK() OVER(ORDER BY val) AS densernk,

    NTILE(100) OVER(ORDER BY val) AS ntile100

    FROM values;

  • Here is one that use partitions:

    USE AdventureWorks2012;

    GO

    SELECT SalesOrderID, ProductID, OrderQty

    ,SUM(OrderQty) OVER(PARTITION BY SalesOrderID) AS Total

    ,CAST(1. * OrderQty / SUM(OrderQty) OVER(PARTITION BY SalesOrderID)

    *100 AS DECIMAL(5,2))AS "Percent by ProductID"

    FROM Sales.SalesOrderDetail

    WHERE SalesOrderID IN(43659,43664);

    GO

Viewing 3 posts - 286 through 287 (of 287 total)

You must be logged in to reply to this topic. Login to reply