05/16/2013
by Marlon Ribunal
1 Comment

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:

[sql]
> order > summary(order)
[/sql]

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

[sql]
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
[/sql]

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.

05/10/2013
by Marlon Ribunal
Comments Off on Non-Tech Books On My Desk

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):

What’s Next:

What’s on the Bookshelf:

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

05/03/2013
by Marlon Ribunal
Comments Off on Visionary: Seeing Through Defects

Visionary: Seeing Through Defects

Joe Lacob bought the struggling Golden State Warriors NBA franchise in 2010. He has been the most hated man by the Warriors fan base since then.

Lacob promised the fans he would turn the franchise around and get it back to the winning edge.

To set the wheels in motion, the Warriors traded their well-loved guard Monta Ellis to the Milwaukee Bucks. The fans hated that move. Who wouldn’t?

Monta Ellis is at his prime. He is a winner. He gives any team a better chance at winning. For the fans, that was an F move – “F” as in Failure.

As if that move wasn’t crazy enough, Lacob and the Warriors Management decided to trade Ellis for an unproven, injured – yes, injured – center Andrew Bogut.

Warriors chance of winning has never looked bleaker. Lacob reputation has gone from “promising” to “idiot” in sixty seconds.

That season the Warriors did not reach the NBA playoffs.

But all that negative reputation was destined to change in one night – the Warriors have won their first playoffs series under Lacob against the feisty Denver Nuggets in the 2012-2013 NBA Season, and Bogut played a big role in that success.

Joe Lacob is a visionary. He saw something that others didn’t, and many others wouldn’t, see. He was ten steps ahead of everybody else.

The Popular Belief Is Not Always Right

Lacob stood by his decisions. He had a vision he wanted to pursue, and acted upon it against the odds. He looked stupid. He earned ridicule. And the fans never believed the Warriors could play past the regular season again under the ownership of Lacob.

The courage to go against the tide of popular belief is never easy. But the visionary just knows what to do – stick to the vision and make himself callous to the ridicule and just move forward and not regress towards defeat.

The Right Decision Is Not Always Popular

It may not have made sense on the onset, but the decision to trade Ellis for the injured, immediately ineffective Bogut has conveyed its intended outcome – Warriors is back on the winning track.

Being right is not the same as winning approval. And, “being right” does not necessarily mean “perceived as being right”. Being right transcends common sense in most cases.

The visionary has the capacity to bear the pains of an ebbing reputation – and the loss of respect of those he perceived to be the benefactor of his decisions – as a result of his unpopular decision.

Vision Is More Powerful Than The Perceived Limitation

Taking risk is stupid. Now, taking calculated risk is brilliant. For the visionary, his chance at success is increased by banking on the strength of potential regardless of the perceived limitations.

For the visionary a winning plan is just that – a plan that happens to have an adjective called “winning”. Success is never won until – brace yourself – you win it.

Giving in to perceived limitations allows taking lesser risks and, and thereby, lesser chances at success. As they say in the investment world, “the lesser the risk, the lesser the profit.”

Selling Vision With Results, Not Words

Selling one’s vision is not about winning the adversary to one’s side. It’s not even about making others see with the same lenses through which you see things in your own perspective.

The visionary does not sell his vision with impressive eloquence but by powerful results.