There are three types of rocks: igneous, sedimentary and metamorphic.
Igneous rocks are formed through the solidification of magma. Deep inside the Earth, temperature are high enough to melt rocks and such molten rocks are called magma. When magma reaches the surface, it cools down and solidifies, forming igneous rocks. These can be extrusive, when magma cools above the surface of Earth or intrusive, if the solidification takes place below the surface of Earth. Some examples of igneous rocks include basalt and granite.
In comparison, sedimentary rocks are formed through the deposition, consolidation and compression of rocks, soil particles and other fragments of existing rocks. Since these rocks are formed from parts of existing rocks, they are also sometimes called secondary rocks. These rocks are generally formed under water, but may also be formed over the ground surface. Some examples of sedimentary rocks include limestone and sandstone.
Metamorphic rocks are formed when intense heat and pressure are applied to existing rocks. Marble and slate are examples of metamorphic rocks.
Hope this helps.