SQL the hard way