{"id":1257,"date":"2015-01-06T20:05:45","date_gmt":"2015-01-06T20:05:45","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=1257"},"modified":"2022-02-17T06:24:03","modified_gmt":"2022-02-17T06:24:03","slug":"add-new-column","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/databases\/sqlite\/columns\/add-new-column","title":{"rendered":"Add new column"},"content":{"rendered":"<h4>\nAdding a new column<br \/>\n<\/h4>\n<pre>\r\n<code>\r\nALTER TABLE tbl_status ADD COLUMN status_default TEXT;\r\n<\/code><\/pre>\n<p>\nThis will cause an error if the column already exists. &nbsp;To check if a column already exists first you can use:\n<\/p>\n<p>\nPRAGMA table_info(tbl_status);\n<\/p>\n<p>\nwhich will return a table listing the columns of the table. &nbsp;However many people use the built in&nbsp;PRAGMA user_version) to store an incremental number which you increment as you update the database design (its starts from zero for a new database nless you specify it).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adding a new column ALTER TABLE tbl_status ADD COLUMN status_default TEXT; This will cause an error if the column already exists. &nbsp;To check if a column already exists first you can use: PRAGMA table_info(tbl_status); which will return a table listing the columns of the table. &nbsp;However many people use the built in&nbsp;PRAGMA user_version) to store [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[],"class_list":["post-1257","post","type-post","status-publish","format-standard","hentry","category-columns"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=1257"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1257\/revisions"}],"predecessor-version":[{"id":1258,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/1257\/revisions\/1258"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=1257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=1257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}