We consider the Dirichlet problem for a class of elliptic and parabolic equations in the upper-half space $mathbb{R}^d_+$, where the coefficients are the product of $x_d^alpha, alpha in (-infty, 1),$ and a bounded uniformly elliptic matrix of coefficients. Thus, the coefficients are singular or degenerate near the boundary ${x_d =0}$ and they may not locally integrable. The novelty of the work is that we find proper weights under which the existence, uniqueness, and regularity of solutions in Sobolev spaces are established. These results appear to be the first of their kind and are new even if the coefficients are constant. They are also readily extended to systems of equations.