Here's why:
* Igneous rocks form from the cooling and solidification of molten rock (magma or lava).
* Metamorphic rocks form when existing rocks (igneous, sedimentary, or even other metamorphic rocks) are transformed by heat, pressure, or chemical reactions.
* Sedimentary rocks form from the accumulation and cementation of sediments (like sand, mud, or shells) that were originally weathered and eroded from other rocks.
Sandstone is specifically formed from the accumulation and cementation of sand grains, which are themselves weathered fragments of other rocks.