There are three types of rocks: igneous, sedimentary and metamorphic. Igneous rocks are the primary rocks and are formed by solidification of molten magma. Depending on whether the cooling of magma takes place above the Earth's surface or underneath it, the igneous rocks can have fine or coarse texture. Igneous rock formation involves phase change of matter: from liquid to solid. Some examples of igneous rocks are basalt, granite, etc.
In comparison, sedimentary rocks are formed by erosion and transportation of existing rocks. Water, wind, etc., erode the existing rocks and transport the eroded material to new regions, where such material is deposited. Over time, rocks are formed by cementing of this material. Sedimentary rocks are the secondary rocks, since they are formed from existing rocks. A prominent feature of sedimentary rocks is the layering of material. Some examples of sedimentary rocks are shale, sandstone, etc.
Hope this helps.