created function to create database