The Shang dynasty or Yin dynasty , according to traditional historiography, ruled in the Yellow River valley in the second millennium BC, succeeding the Xia dynasty and followed by the Zhou dynasty. The classic account of the Shang comes from texts such as the Classic of History, Bamboo Annals and Records of the Grand Historian. According to the traditional chronology based upon calculations made approximately 2,000 years ago by Liu Xin, the Shang ruled from 1766 BC to 1122 BC, but according to the chronology based upon the "current text" of Bamboo Annals, they ruled from 1556 BC to 1046 BC. The Xia-Shang-Zhou Chronology Project dated them from c. 1600 BC to 1046 BC. At its peak 1122 BC it covered an area of 1,250,000km2.

What happened second: Yin dynasty or Xia dynasty?
Xia dynasty