{"id":6514,"date":"2025-03-18T15:52:43","date_gmt":"2025-03-18T13:52:43","guid":{"rendered":"http:\/\/www.ramses.de\/?p=6514"},"modified":"2025-03-18T16:47:42","modified_gmt":"2025-03-18T14:47:42","slug":"faq-access-steuerung-des-hilfefensters-3","status":"publish","type":"post","link":"https:\/\/www.ramses.de\/?p=6514","title":{"rendered":"FAQ Access &#8211; Prim\u00e4r- und Fremdschl\u00fcsselfelder"},"content":{"rendered":"<div>\n<h1>Access Grundlagen &#8211; Prim\u00e4r- und Fremdschl\u00fcsselfelder<\/h1>\n<\/div>\n<h2><strong>Die Idee einer Beziehung<br \/>\n<\/strong><\/h2>\n<p>Viele Datenbanken starten auf Grundlage einer Excel Liste. Irgendwann wird das Arbeiten in Excel einfach un\u00fcbersichtlich und es stellt sich die Frage, ob Access nicht eine Alternative w\u00e4re. Dabei muss man sich der H\u00fcrde der Relationen stellen. Die Grundidee einer Datenbank ist eine ganz andere die einer Tabellenkalkulation. Im Folgenden soll der Unterschied der beiden Ideen dargestellt werden.<\/p>\n<ul>\n<li><a href=\"#Ausgangssituation\">Die Ausgangssituation<\/a><\/li>\n<li><a href=\"#Primaerschluessel\">Der Prim\u00e4rschl\u00fcssel<\/a><\/li>\n<li><a href=\"#Sekundaerschluessel\">Der Sekund\u00e4rschl\u00fcssel<\/a><\/li>\n<li><a href=\"#Fremdschluessel\">Der Fremdschl\u00fcssel<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2 id=\"Ausgangssituation\">Die Ausgangssituation<\/h2>\n<p>In der Excel Tabelle befinden sich die Daten von Kunden, die einen AnsprechpartnerIn haben. Der Kunde hat eine Adresse und der AnsprechpartnerIn hat eine Position im Unternehmen.<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation01.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6515\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation01-1024x310.jpg\" alt=\"\" width=\"900\" height=\"272\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation01-1024x310.jpg 1024w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation01-300x91.jpg 300w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation01-768x232.jpg 768w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation01.jpg 1306w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p>Typisch f\u00fcr eine Excel Tabelle ist zum einen die Einschr\u00e4nkung, dass ich je Kunde nur einen Ansprechpartner haben kann und das sich Texte wie der Ort und das Land wiederholen. Das Wiederholen der Orte etc. nennt man Datenredundanz. Wenn es in der Wiederholung einen Schreibfehler g\u00e4be, so nennt man das Datenredundanz.<\/p>\n<h2>Nimm zwei&#8230;oder mehr<\/h2>\n<p>Das Prinzip einer Datenbank besteht darin, das es nicht nur einen Tabelle gibt, sondern viele. Dabei werden die verschiedenen Tabellen miteinander in Verbindung stehen. Diese Verbindung nennt man Beziehung oder auch Relation.<\/p>\n<h2>Die Tabelle der L\u00e4nder<\/h2>\n<p>Im ersten Schritt werden die Namen der L\u00e4nder in eine eigenst\u00e4ndige Tabelle gepackt. Das kann zum Beispiel mit einer Tabellenerstellungsabfrage erfolgen. Nun haben wir eine Tabelle in der jedes Land einmal enthalten ist.<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation02.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6527\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation02.jpg\" alt=\"\" width=\"260\" height=\"491\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation02.jpg 260w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation02-159x300.jpg 159w\" sizes=\"auto, (max-width: 260px) 100vw, 260px\" \/><\/a><\/p>\n<h3 id=\"Primaerschluessel\">Der Prim\u00e4rschl\u00fcssel<\/h3>\n<p>In einer Datenbank ist es nun notwendig, das jeder Datensatz ein eindeutiges, einmal vorkommendes Merkmal hat.Wir k\u00f6nnten zum einen das bekannte K\u00fcrzel DE f\u00fcr Deutschland w\u00e4hlen, oder aber schlicht und einfach die L\u00e4nder durchnummerieren. Dazu erstellen wir ein eindeutiges Feld, das Access automatisch durchnummeriert. Diese Art eines Z\u00e4hlers nennt Access einen Autowert.<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation03.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6528\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation03.jpg\" alt=\"\" width=\"646\" height=\"148\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation03.jpg 646w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation03-300x69.jpg 300w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/a><\/p>\n<p>Dieses Feld ist nun eindeutig, aber noch kein Schl\u00fcsselfeld. Zum so genannten Prim\u00e4rschl\u00fcssel wird das Feld in dem wir auf den kleinen Schl\u00fcssel klicken<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6529\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation04.jpg\" alt=\"\" width=\"795\" height=\"298\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation04.jpg 795w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation04-300x112.jpg 300w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation04-768x288.jpg 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"Sekundaerschluessel\">Der Sekund\u00e4rschl\u00fcssel<\/h3>\n<p><span class=\"BxUVEf ILfuVd\" lang=\"de\"><span class=\"hgKElc\">Ein Sekund\u00e4rschl\u00fcssel wird er als ein alternativer Suchschl\u00fcssel angesehen, der in einem Datenbanksystem neben dem Prim\u00e4rschl\u00fcssel als zus\u00e4tzliches Suchkriterium zum Auffinden von einem oder mehreren Datens\u00e4tzen verwendet werden kann. In einem indiziertem Feld kann schneller gesucht werden als in einem nicht indizierte Feld.<br \/>\n<\/span><\/span><\/p>\n<p>In diesem Fall legen wir f\u00fcr das Textfeld Land fest, das ein Index definiert wird, der keine Duplikate zul\u00e4sst. Somit kann ich nicht zwei mal Italien in die Tabelle eintragen.<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation05.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6530\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation05.jpg\" alt=\"\" width=\"632\" height=\"444\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation05.jpg 632w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation05-300x211.jpg 300w\" sizes=\"auto, (max-width: 632px) 100vw, 632px\" \/><\/a><\/p>\n<h2>Die Tabelle der Orte<\/h2>\n<p>Nun betrachten wir die Tabelle der Orte, sie ist eine Child Tabelle der L\u00e4nder, dem Parent. Ein Land hat viele Orte.<\/p>\n<h3 id=\"Fremdschluessel\">Der Fremdschl\u00fcssel<\/h3>\n<p>Der Fremdschl\u00fcssel in einer Tabelle der Schl\u00fcssel einer fremden Tabelle. So gibt es im Ort eine Zahlspalte die die Nummer des Landes beinhaltet. Diese Nummer stammt aus einer anderen, also fremden Tabelle.<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation06.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-6531\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation06-1024x530.jpg\" alt=\"\" width=\"900\" height=\"466\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation06-1024x530.jpg 1024w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation06-300x155.jpg 300w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation06-768x398.jpg 768w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation06.jpg 1124w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<h2>Die Beziehungen<\/h2>\n<p>Zwischen dem Elternteil dem Parent und dem Kind, dem Child existiert also eine Beziehung.<\/p>\n<p><a href=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation07.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6532\" src=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation07.jpg\" alt=\"\" width=\"406\" height=\"226\" srcset=\"https:\/\/www.ramses.de\/wp-content\/uploads\/Relation07.jpg 406w, https:\/\/www.ramses.de\/wp-content\/uploads\/Relation07-300x167.jpg 300w\" sizes=\"auto, (max-width: 406px) 100vw, 406px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Access Grundlagen &#8211; Prim\u00e4r- und Fremdschl\u00fcsselfelder Die Idee einer Beziehung Viele Datenbanken starten auf Grundlage einer Excel Liste. Irgendwann wird das Arbeiten in Excel einfach &#8230; <a title=\"FAQ Access &#8211; Prim\u00e4r- und Fremdschl\u00fcsselfelder\" class=\"read-more\" href=\"https:\/\/www.ramses.de\/?p=6514\" aria-label=\"Mehr Informationen \u00fcber FAQ Access &#8211; Prim\u00e4r- und Fremdschl\u00fcsselfelder\">Weiterlesen &#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,43],"tags":[58],"class_list":["post-6514","post","type-post","status-publish","format-standard","hentry","category-access","category-faq","tag-access-2010"],"_links":{"self":[{"href":"https:\/\/www.ramses.de\/index.php?rest_route=\/wp\/v2\/posts\/6514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ramses.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ramses.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ramses.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ramses.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6514"}],"version-history":[{"count":5,"href":"https:\/\/www.ramses.de\/index.php?rest_route=\/wp\/v2\/posts\/6514\/revisions"}],"predecessor-version":[{"id":6535,"href":"https:\/\/www.ramses.de\/index.php?rest_route=\/wp\/v2\/posts\/6514\/revisions\/6535"}],"wp:attachment":[{"href":"https:\/\/www.ramses.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ramses.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ramses.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}