Business Intelligence, SQL Server, SQLServerPedia Syndication

Rated R (A Teaser)

How many lines of TSQL codes and Window Functions you need to come up with this?

RWithSQLServer2012

With R, it takes about 2 commands:

> order <- as.matrix(sqlFetch(ch,"SalesDetails")
> summary(order)

To give you an idea, I prepared the dataset into a view like this:

CREATE VIEW SalesDetails
AS
SELECT
 soh.OrderDate AS [Date],
 soh.SalesOrderID,
 ppc.Name AS Category,
 pps.Name AS Subcat,
 pp.Name as Product,
 SUM(sd.OrderQty) AS Qty,
 SUM(sd.LineTotal) AS LineTotal
FROM Sales.SalesPerson sp
 INNER JOIN Sales.SalesOrderHeader AS soh
 ON sp.BusinessEntityID = soh.SalesPersonID
 INNER JOIN Sales.SalesOrderDetail AS sd
 ON sd.SalesOrderID = soh.SalesOrderID
 INNER JOIN Production.Product AS pp
 ON sd.ProductID = pp.ProductID
 INNER JOIN Production.ProductSubcategory AS pps
 ON pp.ProductSubcategoryID = pps.ProductSubcategoryID
 INNER JOIN Production.ProductCategory AS ppc
 ON ppc.ProductCategoryID = pps.ProductCategoryID
GROUP BY ppc.Name, soh.OrderDate, soh.SalesOrderID, ppc.name, pps.Name, pp.Name,
 soh.SalesPersonID

And, that’s it. I just fed that view to the R engine and it summarized the dataset just by using those two commands.

This is not the perfect dataset to test with R.

I’d love to dig deeper into R because of its powerful analytical features.

What is R?

“R is a language and environment for statistical computing and graphics.”

If you’re into statistics, linear/non-linear modelling, or simply want to try another tool to analyze your data warehouse, give R a shot.

If you want to start digging with R, Ted Malone ( b | t ) has a nice introduction to using R with SQL Server 2012. Get more information about R on the R Project website.

Standard
SQL Server, SQLServerPedia Syndication, Training

SQLMentor: Do you have a mentor?

I’ve been looking for better ways of learning and improving my SQL Server skills. Blogs, BOL, webcasts, and training videos are great learning aids. Having the right tools and method makes a lot of difference. Building a SQL Server VM Playground to put the lessons in practice is a vital part of the learning process.

In The 4-Hour Chef,Timothy Ferriss suggests a recipe for learning any skill, which is pretty much applicable to learning SQL Server:

DeconstructionWhat are the minimal learnable units, the LEGO blocks, I should be starting with?

SelectionWhich 20% of the blocks should I focus on for 80% or more of the outcome I want?

Sequencing - In what order should I learn the blocks?

StakesHow do I set up stakes to create real consequences and guarantee I follow the program?

“Where do I start?” is always the first question we ask when we want to learn something new. And the answer to that is the fundamentals – the building blocks.

The same is true with SQL Server. You want to learn how to be great at Performance Tuning? Learn the Database Structure and Index Internals. You want to master Disaster Recovery? Learn the Data Storage and Backup Internals. It’s always going back to the basics.

With a huge system such as SQL Server, learning just the basics alone can still be overwhelming. You need to deconstruct SQL Server into “minimal learnable units”. You have to select and line up what you want to learn in a sequence that aligns to your learning goals.

Sometimes you just know what you want and how to get it. You want to become better at skill x, and you know that getting there would take y and z.

But you can raise the bar one notch.

You can study and learn on your own but wouldn’t it be great if someone can give you guidance and direction – someone that will not only show you the ropes but will also help you find the most effective way of achieving your desired outcome.

Get a mentor who’ll bring out the best in you.

I am currently under the mentorship of Edwin Sarmiento (b | t). He’s doing a great deal of work in helping the SQL Sever Community around the world (check his MVP Profile). This is my first experience having a mentor in learning and building my SQL Server skills. I should have done this sooner.

Wikipedia defines Mentorship this way:

“Mentorship is a personal developmental relationship in which a more experienced or more knowledgeable person helps to guide a less experienced or less knowledgeable person. However, true mentoring is more than just answering occasional questions or providing ad hoc help. It is about an ongoing relationship of learning, dialog, and challenge.”

There are three things to take away from that definition:

Learning – Since your mentor is someone who has “been there, done that”, he exactly knows how to deconstruct the challenges you’re facing based on your strength and weaknesses. A relationship between you and your mentor must therefore be established prior to your mentoring sessions.

Dialog – A line of communication should always be open between you. A good mentor is someone who provides an open channel through which he makes himself accessible at any reasonable time. A constant dialog must be in place to communicate what’s needed on both side.

Challenge – We become better by overcoming challenges. A great mentor provides challenges that are tailored to test our aptitude. Not only that, challenges keep the process interesting. On the mentor’s side, the real challenge for him is not only to help us get closer to our goals but also to make us see our Purpose.

Do you have a mentor?

Standard
Career, SQL Server, SQLServerPedia Syndication

I’m Thankful for 978-1-84968-508-5

There are things that I’m thankful for this year. Yes, I also got a lot of setbacks but that wouldn’t make me less thankful.

I’m thankful for my family as always. No words can ever describe how thankful I am for the gift of family.

I’m also thankful for my #SQLFamily. Thank you for the gift of friendship. Thank you all for sharing your knowledge. But, mostly, thanks for the friendship.

And now, the book.

I have signed a contract with a publisher to write a book on SQL Server 2012 (dev side). I’ll provide more details as they become available.

That number at the title of this post? 978-1-84968-508-5 – yes, that’s the ISBN.

Thank you for the opportunity to write a book.

Standard