Creating and querying the database for data working