Where does a dragons magic come from?

Wizards learn spells in spell books Learning the techniques needed to cast, sorcerors have an innate magical ability, warlocks are given powers by a deity or other powerful being.

Clerics and druids receive there magic from a deity, nature or the land.

But where do dragons learn there magic? Are they inherent casters like a sorceror, or do they have books and libraries like a wizard? Does a dragon know all the spells available to it picking which are prepared each day like a cleric Druid or bard, or like a wizard Or sorceror do they need to pre select which spells they have access to each day preparing from a fixed list?