Dinosaurs lived between 245 and 65 mya (million years ago). This time period is called the Mesozoic Era, commonly referred to as the 'Age of Dinosaurs'. During the Mesozoic different species of dinosaurs appeared and disappeared as they evolved and died out. No single species of animal existed for this entire age.
The Mesozoic is split into three distinct periods:
The Triassic Period between 245mya to 200mya
The Jurassic Period between 200mya to 144mya
The Cretaceous Period between 144mya and 65mya
Just before the Mesozoic, at the end of the Palaeozoic Era, there was a mass extinction event during which almost 90% of species died out. Conditions were bad but they suited a small hardy reptile that all species of dinosaur evolved from.
At the end of the Mesozoic there was another extinction event. This time conditions suited Mammals and Dinosaurs became extinct.