<br />
<b>Warning</b>:  Undefined array key "global_protection_id" in <b>/home/wikitechy/public_html/interview-questions/wp-content/plugins/content-protector/inc/class-ps-rest-handler.php</b> on line <b>51</b><br />
{"id":4831,"date":"2022-08-20T07:55:57","date_gmt":"2022-08-20T07:55:57","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=4831"},"modified":"2022-08-20T07:55:57","modified_gmt":"2022-08-20T07:55:57","slug":"what-is-a-primary-key","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/","title":{"rendered":"What is a primary key ?"},"content":{"rendered":"<ul>\n<li style=\"text-align: justify;\">In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.<\/li>\n<li style=\"text-align: justify;\">Primary key is a special realational database table column key that uniquely identifies a table record.<\/li>\n<li style=\"text-align: justify;\">In a table if primary key needs to be created then we have to define a primary key constraint when you create or modify a table.<\/li>\n<li style=\"text-align: justify;\">When multiple coulmns are declared as primary key then it is called as Composite key.<\/li>\n<li style=\"text-align: justify;\">A table should not contain more than one primary key.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">A primary key\u2019s main features are:<\/p>\n<ul style=\"text-align: justify;\">\n<li>It must contain a unique value for each row of data. A table can have only one primary key constraint<\/li>\n<li>It cannot contain null values.<\/li>\n<li>Every row must have a primary key value.<\/li>\n<li>It enforces the entity integrity of data.<\/li>\n<li>Primary key always has a unique data.<\/li>\n<li>Primary key length cannot be more than 900 bytes.<\/li>\n<li>Primary key cannot have a null value.<\/li>\n<li>Duplicate values are not allowed in primary key.<\/li>\n<li style=\"text-align: justify;\">A primary key might use one or more fields already present in the table, or a unique field can be created to be the primary key.<\/li>\n<\/ul>\n<p style=\"text-align: justify;\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-full wp-image-4832\" src=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png\" alt=\"\" width=\"621\" height=\"501\" srcset=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png 621w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key-300x242.png 300w, https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key-390x315.png 390w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation. Primary key is a special realational database table column key that uniquely identifies a table record. In a table if primary key needs to be created then we have to define a primary key constraint when [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"passster_activate_protection":false,"passster_protect_child_pages":"","passster_protection_type":"password","passster_password":"","passster_activate_overwrite_defaults":"","passster_headline":"","passster_instruction":"","passster_placeholder":"","passster_button":"","passster_id":"","passster_activate_misc_settings":"","passster_redirect_url":"","passster_hide":"no","passster_area_shortcode":"","gtb_hide_title":false,"gtb_wrap_title":false,"gtb_class_title":"","gtb_remove_headerfooter":false,"footnotes":""},"categories":[6547],"tags":[18543,18544,18535,18533,18524,18537,18538,18539,18529,18541,18542,18526,18531,18528,18540,18532,18527,18525,18530,18534,18536],"class_list":["post-4831","post","type-post","status-publish","format-standard","hentry","category-sql","tag-define-what-is-a-primary-key","tag-postgres-what-is-a-primary-key","tag-primary-key-example","tag-what-is-a-foreign-key","tag-what-is-a-primary-key","tag-what-is-a-primary-key-and-explain-its-characteristics","tag-what-is-a-primary-key-and-foreign-key","tag-what-is-a-primary-key-and-foreign-key-in-sql","tag-what-is-a-primary-key-class","tag-what-is-a-primary-key-example","tag-what-is-a-primary-key-explain","tag-what-is-a-primary-key-in-a-database","tag-what-is-a-primary-key-in-a-relational-database","tag-what-is-a-primary-key-in-access","tag-what-is-a-primary-key-in-computer","tag-what-is-a-primary-key-in-dbms","tag-what-is-a-primary-key-in-mysql","tag-what-is-a-primary-key-in-sql","tag-what-is-a-primary-key-used-for-in-a-database","tag-what-is-primary-key-and-foreign-key","tag-what-is-primary-key-in-ms-access"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What is a primary key ? - SQL Primary Key - What is the Primary Key<\/title>\n<meta name=\"description\" content=\"What is a primary key ? - In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is a primary key ? - SQL Primary Key - What is the Primary Key\" \/>\n<meta property=\"og:description\" content=\"What is a primary key ? - In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-20T07:55:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png\" \/>\n<meta name=\"author\" content=\"webmaster\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webmaster\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/\",\"name\":\"What is a primary key ? - SQL Primary Key - What is the Primary Key\",\"isPartOf\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png\",\"datePublished\":\"2022-08-20T07:55:57+00:00\",\"dateModified\":\"2022-08-20T07:55:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\"},\"description\":\"What is a primary key ? - In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/#primaryimage\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png\",\"contentUrl\":\"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png\",\"width\":621,\"height\":501},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#website\",\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4\",\"name\":\"webmaster\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g\",\"caption\":\"webmaster\"},\"sameAs\":[\"https:\/\/www.wikitechy.com\/interview-questions\"],\"url\":\"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is a primary key ? - SQL Primary Key - What is the Primary Key","description":"What is a primary key ? - In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/","og_locale":"en_US","og_type":"article","og_title":"What is a primary key ? - SQL Primary Key - What is the Primary Key","og_description":"What is a primary key ? - In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/","og_site_name":"Wikitechy","article_published_time":"2022-08-20T07:55:57+00:00","og_image":[{"url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png"}],"author":"webmaster","twitter_card":"summary_large_image","twitter_misc":{"Written by":"webmaster","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/","name":"What is a primary key ? - SQL Primary Key - What is the Primary Key","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png","datePublished":"2022-08-20T07:55:57+00:00","dateModified":"2022-08-20T07:55:57+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4"},"description":"What is a primary key ? - In relational database primary key is a specific choice of minimal set of attributes that uniquely specify a relation.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/sql\/what-is-a-primary-key\/#primaryimage","url":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png","contentUrl":"https:\/\/www.wikitechy.com\/interview-questions\/wp-content\/uploads\/2022\/08\/primary-key.png","width":621,"height":501},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/f785ba3ecc599133e65ab6138042a3e4","name":"webmaster","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/155b77fd8cdda3d0913fcb7e7ee63543b0c345d2d8f6dcebda5b0583ab61f967?s=96&d=mm&r=g","caption":"webmaster"},"sameAs":["https:\/\/www.wikitechy.com\/interview-questions"],"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/webmaster\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=4831"}],"version-history":[{"count":1,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4831\/revisions"}],"predecessor-version":[{"id":4833,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/4831\/revisions\/4833"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=4831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=4831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=4831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}