Slesvig & Holsten were two sparsely populated duchies (dukedoms) which had been ruled by Danish kings since 1460. Holsten was wholly German-speaking; Slesvig was mixed German/Danish speaking.Slesvig had been closely associated with Holsten since medieval times. With the end of the Holy Roman Empire in 1806, Denmark incorporated Holsten under the Danish crown. Frederik VI remained duke of Holsten, but allowed Holsten and adjoinng Lauenburg (acquired in 1814) to join the newly established Confederation of German States. Slesvig did not join. This set the stage for a complex conflict against pan-Germanism, with dynastic and territorial dimensions.
In the first Slesvig-Holsten war (1848-50) the Danes retained the territories, roundly defeating the Germans at Fredericia on 6 July 1849.
Bismarck and pan-Germanism continued to gather support and in 1864 German and Austrian forces prevailed. Slesvig, Holsten & Lauenburg were incorporated into Germany, and Denmark lost 1/3 of its territory and population, reducing it to its smallest size since consolidation of the kingdom, with a frontier across Jutland just south of Ribe.
In 1920 a referendum allocated Northern Slesvig and the island of Als to Denmark. This became Synderjyllands amt. The remainder of Slesvig (including Flensborg) became part of what is now the German Land of Schleswig-Holstein. This border has not changed since 1920
Danish Holsten was administered from Itzehoe, and Slesvig from the town of the same name.
See Alastair H Thomas and S.P. Oakley, Historical Dictionary fo Denmark (Lanham, Maryland and Oxford: Scarecrow Press, 1999) - it also includes much useful information on 'great Danes'.