{"id":3075,"date":"2019-12-23T16:35:54","date_gmt":"2019-12-23T16:35:54","guid":{"rendered":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs\/?post_type=chapter&#038;p=3075"},"modified":"2024-05-17T00:18:31","modified_gmt":"2024-05-17T00:18:31","slug":"primary-key","status":"publish","type":"chapter","link":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/chapter\/primary-key\/","title":{"raw":"Primary Key","rendered":"Primary Key"},"content":{"raw":"<div class=\"textbox learning-objectives\">\r\n<h3>Learning Outcomes<\/h3>\r\n<ul>\r\n \t<li>Discuss the importance of primary key uniqueness<\/li>\r\n \t<li>Choose a primary key<\/li>\r\n<\/ul>\r\n<\/div>\r\nEvery table must have a primary key\u2014a field with a unique value for each record. Otherwise there would be no way to distinguish between records. A primary key consists of one or more fields that uniquely identify each record that you store in the table. Often, there is a unique identification number, such as an ID number, a serial number, or a code, that serves as a primary key.\r\n\r\nFor example, you might have a Customers table where each customer has a unique customer ID number. The customer ID field is the primary key of the Customers table. When a primary key contains more than one field, it is usually composed of pre-existing fields that, taken together, provide unique values. For example, you might use a combination of last name, first name, and birth date as the primary key for a table about people.\r\n<h2>Choosing a Primary Key<\/h2>\r\nWithout the ProductID field, another field would be needed to uniquely identify each product in the database. Without a strong primary key, the database engine would be at a loss to perform basic operations on the table properly.\r\n\r\nGood primary keys must:\r\n<ul>\r\n \t<li style=\"font-weight: 400;\">Uniquely identify each record,<\/li>\r\n \t<li style=\"font-weight: 400;\">Not be null,<\/li>\r\n \t<li style=\"font-weight: 400;\">Exist when the record is created,<\/li>\r\n \t<li style=\"font-weight: 400;\">Must remain stable,<\/li>\r\n \t<li style=\"font-weight: 400;\">Be simple and contain as few attributes as possible.<\/li>\r\n<\/ul>\r\n<div class=\"textbox tryit\">\r\n<h3>Practice Questions<\/h3>\r\nhttps:\/\/assess.lumenlearning.com\/practice\/9b9c22f0-2b48-4e32-b388-5c4e9cf38952\r\n\r\nhttps:\/\/assess.lumenlearning.com\/practice\/410238cd-dc25-4f19-9b09-44b6e9877a44\r\n\r\n<\/div>","rendered":"<div class=\"textbox learning-objectives\">\n<h3>Learning Outcomes<\/h3>\n<ul>\n<li>Discuss the importance of primary key uniqueness<\/li>\n<li>Choose a primary key<\/li>\n<\/ul>\n<\/div>\n<p>Every table must have a primary key\u2014a field with a unique value for each record. Otherwise there would be no way to distinguish between records. A primary key consists of one or more fields that uniquely identify each record that you store in the table. Often, there is a unique identification number, such as an ID number, a serial number, or a code, that serves as a primary key.<\/p>\n<p>For example, you might have a Customers table where each customer has a unique customer ID number. The customer ID field is the primary key of the Customers table. When a primary key contains more than one field, it is usually composed of pre-existing fields that, taken together, provide unique values. For example, you might use a combination of last name, first name, and birth date as the primary key for a table about people.<\/p>\n<h2>Choosing a Primary Key<\/h2>\n<p>Without the ProductID field, another field would be needed to uniquely identify each product in the database. Without a strong primary key, the database engine would be at a loss to perform basic operations on the table properly.<\/p>\n<p>Good primary keys must:<\/p>\n<ul>\n<li style=\"font-weight: 400;\">Uniquely identify each record,<\/li>\n<li style=\"font-weight: 400;\">Not be null,<\/li>\n<li style=\"font-weight: 400;\">Exist when the record is created,<\/li>\n<li style=\"font-weight: 400;\">Must remain stable,<\/li>\n<li style=\"font-weight: 400;\">Be simple and contain as few attributes as possible.<\/li>\n<\/ul>\n<div class=\"textbox tryit\">\n<h3>Practice Questions<\/h3>\n<p>\t<iframe id=\"assessment_practice_9b9c22f0-2b48-4e32-b388-5c4e9cf38952\" class=\"resizable\" src=\"https:\/\/assess.lumenlearning.com\/practice\/9b9c22f0-2b48-4e32-b388-5c4e9cf38952?iframe_resize_id=assessment_practice_id_9b9c22f0-2b48-4e32-b388-5c4e9cf38952\" frameborder=\"0\" style=\"border:none;width:100%;height:100%;min-height:300px;\"><br \/>\n\t<\/iframe><\/p>\n<p>\t<iframe id=\"assessment_practice_410238cd-dc25-4f19-9b09-44b6e9877a44\" class=\"resizable\" src=\"https:\/\/assess.lumenlearning.com\/practice\/410238cd-dc25-4f19-9b09-44b6e9877a44?iframe_resize_id=assessment_practice_id_410238cd-dc25-4f19-9b09-44b6e9877a44\" frameborder=\"0\" style=\"border:none;width:100%;height:100%;min-height:300px;\"><br \/>\n\t<\/iframe><\/p>\n<\/div>\n\n\t\t\t <section class=\"citations-section\" role=\"contentinfo\">\n\t\t\t <h3>Candela Citations<\/h3>\n\t\t\t\t\t <div>\n\t\t\t\t\t\t <div id=\"citation-list-3075\">\n\t\t\t\t\t\t\t <div class=\"licensing\"><div class=\"license-attribution-dropdown-subheading\">CC licensed content, Original<\/div><ul class=\"citation-list\"><li>Primary Key. <strong>Authored by<\/strong>: Robert Danielson. <strong>Provided by<\/strong>: Lumen Learning. <strong>License<\/strong>: <em><a target=\"_blank\" rel=\"license\" href=\"https:\/\/creativecommons.org\/licenses\/by\/4.0\/\">CC BY: Attribution<\/a><\/em><\/li><\/ul><\/div>\n\t\t\t\t\t\t <\/div>\n\t\t\t\t\t <\/div>\n\t\t\t <\/section>","protected":false},"author":17,"menu_order":10,"template":"","meta":{"_candela_citation":"[{\"type\":\"original\",\"description\":\"Primary Key\",\"author\":\"Robert Danielson\",\"organization\":\"Lumen Learning\",\"url\":\"\",\"project\":\"\",\"license\":\"cc-by\",\"license_terms\":\"\"}]","CANDELA_OUTCOMES_GUID":"fbd6cb5f-37ad-45c5-86e2-2f78d3eaf9d8, 21c2c8ed-23c0-48ff-a174-27f78af1c8b6, 0d93bab7-d8aa-480c-9284-c14544e1abb6","pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-3075","chapter","type-chapter","status-publish","hentry"],"part":2773,"_links":{"self":[{"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/chapters\/3075","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/wp\/v2\/users\/17"}],"version-history":[{"count":8,"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/chapters\/3075\/revisions"}],"predecessor-version":[{"id":5939,"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/chapters\/3075\/revisions\/5939"}],"part":[{"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/parts\/2773"}],"metadata":[{"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/chapters\/3075\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/wp\/v2\/media?parent=3075"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/pressbooks\/v2\/chapter-type?post=3075"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/wp\/v2\/contributor?post=3075"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/courses.lumenlearning.com\/wm-computerapplicationsmgrs-2\/wp-json\/wp\/v2\/license?post=3075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}