Hammurabi was an ancient king who ruled a small city-state in Mesopotamia, called Babylonia. Hammurabi ruled for 42 years from 1792 BCE (Before Current Era)-1834 BCE. Around Hammurabiâs 38 year of rule, he created a law code which he carved on a large stone column called a stele.