construct database