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
Personal

Non-Tech Books On My Desk

This post is inspired by Andy Warren’s ( b | t ) “Books On The Desk” post.

I’ve got plenty of SQL Server books at home (physical and Kindle versions). But if I’m not in the mood of reading a tech book but itching to read anyway, I’d grab any book that interests me at the moment.

If I found a book interesting enough, I’d keep it for re-reading. Some of the books I listed below are rereads.

These are the books on my “reading desk” (read/re-read):

  • “The Art of the Start” by Guy Kawasaki
  • “Thou Shall Prosper: Ten Commandments for Making Money” by Daniel Lapin
  • “Super Freakonomics: Global Cooling, Patriotic Prostitutes, and Why Suicide Bombers Should Buy Life Insurance” by Steven D. Levitt
  • “Linchpin: Are You Indispensable? ” by Seth Godin
  • “The Dip: A Little Book That Teaches You When to Quit (and When to Stick) ” by Seth Godin
  • “Outliers: The Story of Success” by Malcolm Gladwell

What’s Next:

  • “Rework” by Jason Fried and David Heinemeier Hansson
  • “The Lean Startup: How Today’s Entrepreneurs Use Continuous Innovation to Create Radically Successful Businesses” by Eric Ries
  • “Tribes: We Need You to Lead Us” by Seth Godin
  • “Tribal Leadership: Leveraging Natural Groups to Build a Thriving Organization” by Dave Logan et al

What’s on the Bookshelf:

  • “Getting Things Done: The Art of Stress-Free Productivity” by David Allen
  • “The 7 Habits of Highly Effective People: Powerful Lessons in Personal Change” by Stephen R. Covey
  • “The Tools: Transform Your Problems into Courage, Confidence, and Creativity” by Phil Stutz
  • “The Power of Habit: Why We Do What We Do in Life and Business” by Charles Duhigg
  • “The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich (Expanded and Updated)” by Tim Ferris
  • “The 4-Hour Body: An Uncommon Guide to Rapid Fat-Loss, Incredible Sex, and Becoming Superhuman” by Tim Ferriss
  • “The 4-Hour Chef: The Simple Path to Cooking Like a Pro, Learning Anything, and Living the Good Life” by Tim Ferriss
  • “The Total Money Makeover: A Proven Plan for Financial Fitness” by Dave Ramsey
  • “ProBlogger: Secrets for Blogging Your Way to a Six-Figure Income” by Darren Rowse

How about you? What are the non-tech books you read?

Standard