Coal is present inside the Earth's surface in coal beds or coal seams. From here it is extracted out and this process of extraction of coal is known as mining.
Since petroleum and natural gas deposits are present deep inside the Earth's surface, so the petroleum and natural gas extraction starts with drilling into underground reservoirs. Natural gas being lighter than petroleum is present above petroleum deposits. So when drilling pipes reach the deposits, natural gas gets pumped out first followed by petroleum.