Database setup and sql quiers to be turned into stored procedures