Depth of field - also sometimes known as depth of focus - is an area many photographers feel some confusion over. By changing the aperture in the lens, you can make the resulting picture have more of the picture in focus from near to far, or you can limit the picture's focus on one place. At ƒ1.8, the focus point will be much more defined with things in front of and behind the subject becoming softer looking the further from the subject they are. This is a very nice way to bring attention to the subject. At ƒ22, the focus will seem to be sharp from very close to the camera to pretty much infinity. This is great for giving a sense of the place you shot the image, or for including many people in the image and keeping everyone clearly in focus. However, there are limits to how that will appear in the final image.
Exercise: Find a subject/object that is still or will be in one place for a couple of minutes. Stand about 2 feet from the subject and focus on it. Set your ƒstop to 1.8 (or a close as possible to that based on the light) and set the shutter speed to get a proper exposure according to your meter. Now set your ƒstop to 16 and change the shutter as needed. Step back to about 10 feet from your subject and re do the above settings - first at ƒ1.8 then at ƒ16. To really push this exercise, try all the above steps with different lenses or at different lengths if you have a zoom lens - i.e.. try it at 35 mm and at 200mm, or whatever your zoom lens range. Also create images like these two examples. In the first photograph, notice how the foreground is out of focus but the subject is in focus. In the second photograph, see how the background is out of focus but the subject is in focus. Practice these depth of field or depth of focus techniques.