Sparse matrix multiplication using SQL was also a homework assignment in the latest coursera course "Introduction to Data Science" by Bill Howe
Correct me if I'm wrong, but the only reason the matrix being sparse is mentioned is because the author stuck a bunch of 0s in the matrices... this solution should work regardless of the sparsity.