{"id":100,"date":"2024-03-28T21:47:21","date_gmt":"2024-03-28T21:47:21","guid":{"rendered":"https:\/\/www.kwwd.co.uk\/blog\/?p=100"},"modified":"2024-03-28T21:47:39","modified_gmt":"2024-03-28T21:47:39","slug":"add-a-primary-key-to-a-table-in-mysql","status":"publish","type":"post","link":"https:\/\/www.kwwd.co.uk\/blog\/add-a-primary-key-to-a-table-in-mysql\/","title":{"rendered":"Add A Primary Key To A Table In MYSQL"},"content":{"rendered":"<p>Run the following code to amend an existing column into a Primary Key<\/p>\n<pre><code class=\"code-container\" role=\"text\" data-test-id=\"code-content\"><span class=\"hljs-keyword\"> ALTER<\/span> <span class=\"hljs-keyword\">TABLE<\/span> `wp_posts`\r\n  <span class=\"hljs-keyword\">ADD<\/span> <span class=\"hljs-keyword\">PRIMARY<\/span> KEY (`ID`),\r\n  MODIFY `ID` <span class=\"hljs-type\">bigint<\/span>(<span class=\"hljs-number\">20<\/span>) UNSIGNED <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-keyword\">NULL<\/span> AUTO_INCREMENT;<\/code><code class=\"language-sql\"><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Run the following code to amend an existing column into a Primary Key ALTER TABLE `wp_posts` ADD PRIMARY KEY (`ID`), MODIFY `ID` bigint(20) UNSIGNED NOT [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[24,35],"class_list":["post-100","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql","tag-primary-key"],"_links":{"self":[{"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":0,"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kwwd.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}