added db

put sql function in so as to make it easier.