Here's how it happens:
* Sedimentation: Sand grains, primarily composed of quartz, are carried by rivers, wind, and ocean currents. They settle at the bottom of the ocean, forming layers.
* Compaction: Over time, the weight of overlying layers compresses the sand, squeezing out water and air. This process is called compaction.
* Cementation: Dissolved minerals in the water between the sand grains crystallize, acting as a glue that binds the grains together. This process is called cementation.
The resulting rock, sandstone, is a sedimentary rock that is known for its porous and permeable nature.