{"id":4430,"date":"2023-11-24T15:41:10","date_gmt":"2023-11-24T15:41:10","guid":{"rendered":"https:\/\/ibex.tech\/python\/?p=4430"},"modified":"2023-11-27T12:30:02","modified_gmt":"2023-11-27T12:30:02","slug":"creating-tables","status":"publish","type":"post","link":"https:\/\/ibex.tech\/python\/database\/sqlite\/tables\/creating-tables","title":{"rendered":"Creating tables"},"content":{"rendered":"\n<p>Example create\/open a database and return it ready to be used<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import sqlite3\n\n    #Open the database (will be created if not already present)\n    db1 = sqlite3.connect(C:\\\\MyFolderName\\\\MyDatabaseName.db')\n    db1cursor = db1.cursor()        #Get the cursor object to access the database\n\n    db1cursor.execute(\"\"\"CREATE TABLE IF NOT EXISTS tblMyTableName (\n                        Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\n                        MyIntigerField INTEGER,\n                        MyNumericField NUMERIC,\n                        MyRealField REAL,\n                        MyTextField TEXT\n        )\"\"\")\n    db1.commit()<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Example create\/open a database and return it ready to be used<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[353],"tags":[],"class_list":["post-4430","post","type-post","status-publish","format-standard","hentry","category-tables"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/comments?post=4430"}],"version-history":[{"count":2,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4430\/revisions"}],"predecessor-version":[{"id":4451,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4430\/revisions\/4451"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/media?parent=4430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/categories?post=4430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/tags?post=4430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}