sql for base database