Properties db

Changed SQL as Marv suggested