{"id":5446,"date":"2016-10-24T04:25:36","date_gmt":"2016-10-24T04:25:36","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=5446"},"modified":"2017-04-20T11:11:57","modified_gmt":"2017-04-20T11:11:57","slug":"how-to-get-primary-key-of-a-table-from-sqlite","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/sqlite\/how-to-get-primary-key-of-a-table-from-sqlite.html","title":{"rendered":"How to get primary key of a table from SQLite"},"content":{"rendered":"<p>Run<\/p>\n<p><code>PRAGMA table_info('my_table_name')<\/code><\/p>\n<p>find the record that column &#8216;pk&#8217; is 1, it&#8217;s the primary key.<\/p>\n<p>See also:<\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/postgresql\/how-to-get-primary-key-of-a-table-from-postgresql.html\">How to get primary key of a table from PostgreSQL<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/mysql\/how-to-get-primary-key-of-a-table-from-mysql.html\">How to get primary key of a table from MySQL<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/sql-server\/how-to-get-primary-key-of-a-table-from-sql-server.html\">How to get primary key of a table from SQL Server<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/db2\/how-to-get-primary-key-of-a-table-from-db2.html\">How to get primary key of a table from DB2<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/oracle\/how-to-get-primary-key-of-a-table-from-oracle.html\">How to get primary key of a table from Oracle<\/a><\/p>\n<p>Some SQLite tools you can try: <a href=\"https:\/\/www.withdata.com\/sqlite\/\"> https:\/\/www.withdata.com\/sqlite\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Run PRAGMA table_info(&#8216;my_table_name&#8217;) find the record that column &#8216;pk&#8217; is 1, it&#8217;s the primary key. See also: How to get primary key of a table from PostgreSQL How to get primary key of a table from MySQL How to get primary key of a table from SQL Server How to get primary key of a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[429],"tags":[1719,1369],"class_list":["post-5446","post","type-post","status-publish","format-standard","hentry","category-sqlite","tag-get-primary-key","tag-sqlite"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/5446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=5446"}],"version-history":[{"count":3,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/5446\/revisions"}],"predecessor-version":[{"id":6466,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/5446\/revisions\/6466"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=5446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=5446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=5446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}