sql storing and mining