Numerical studies were made of the flow of a viscous fluid in a two-dimensional square container. The flows are driven by the top sliding wall, which executes sinusoidal oscillations. Numerical solutions were acquired by solving the time-dependent, two-dimensional incompressible Navier-Stokes equations. Results are presented for wide ranges of two principal physical parameters, i.e., Re, the Reynolds number and omega', the nondimensional frequency of the lid oscillation. Comprehensive details of the flow structure are presented. When omega' is small, the flow bears qualitative similarity to the well-documented steady driven-cavity flow. The flow in the bulk of cavity region is affected by the motion of the sliding upper lid. On the contrary, when omega' is large, the fluid motion tends to be confined within a thin layer near the oscillating lid. In this case, the flow displays the characteristic features of a thin-layer flow. When omega' is intermediate, omega' approximately O(1), the effect of the side walls is pronounced; the flow pattern reveals significant changes between the low-Re and high-Re limits. Streamline plots are constructed for different parameter spaces. Physically informative interpretations are proposed which help gain physical insight into the dynamics. The behavior of the force coefficient C(f) has been examined. The magnitude and phase lag of C(f) are determined by elaborate post-processings of the numerical data. By utilizing the wealth of the computational results, characterizations of C(f) as functions of Re and omega' are attempted. These are in qualitative consistency with the theoretical predictions for the limiting parameter values.