Weathering and erosion of the Earth's surface, primarily by flowing water but also caused by other agents such as wind and chemical dissolution, causes rocks and soil to wear away. Streams, wind, landslides, and glaciers transport the sediment downhill to a region of deposition, usually but not always underwater. Deposition of mineral and organic particles can take place on land or underwater, causing successive strata of sediment to build up in layers. As more layers of sediment accumulate above, the lower layers are transformed into rock by heat and pressure.
Depending on the type and size of particles that are deposited, as well as the environment, different types of sedimentary rock are created. Although the technical definitions are beyond our needs here, sandstone forms when small grains of hard minerals such as quartz and feldspar are cemented together. In contrast, shale forms when the grains are silt-sized, or much finer than sand.
Limestone is usually formed underwater from skeletons of small sea creatures such as coral and mollusks. Coal is a sedimentary rock formed from accumulations of plants. Chemical precipitation of minerals in solution, as when a large lake dries up, creates sedimentary rocks from evaporite minerals such as halite (common table salt) and gypsum.
Less commonly, sedimentary rocks form from landslides, volcanic flows of hot ash, and impact debris from a meteorite strike. Read more about Rocks: Geologic Books on a Shelf