{"id":212,"date":"2022-04-23T12:23:17","date_gmt":"2022-04-23T10:23:17","guid":{"rendered":"https:\/\/markdown.land\/?p=212"},"modified":"2023-10-18T22:01:47","modified_gmt":"2023-10-18T20:01:47","slug":"sqlite-markdown","status":"publish","type":"post","link":"https:\/\/markdown.land\/sqlite-markdown","title":{"rendered":"SQLite Markdown: Format Query Results In Markdown"},"content":{"rendered":"\n<p>If you&#8217;re an <a href=\"https:\/\/sqlite.land\">SQLite<\/a> user, exporting data from your queries directly to Markdown might be useful. This article shows you how to export SQLite queries to Markdown format. The good news is that you can do this with built-in SQLite features!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"using-sqlites-markdown-mode\"><\/span>Using SQLite&#8217;s Markdown mode<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>By far the easiest method is to change the SQLite output mode to markdown. To enable SQLite&#8217;s Markdown output mode, simply enter the command <code>.mode markdown<\/code> in your <a href=\"https:\/\/sqlite.land\/sqlite-browser\" target=\"_blank\" rel=\"noreferrer noopener\">SQLite browser\/command prompt<\/a>. Because the output looks so clear, I actually do this all the time, even when I don&#8217;t want to export to Markdown. Here&#8217;s an example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;elegant&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">sqlite&gt; .mode markdown\nsqlite&gt; select * from customers limit 2;\n| name | age |\n|------|-----|\n| Erik | 40  |\n| Mary | 53  |<\/pre><\/div>\n\n\n\n<p>You can copy\/paste this to a Markdown file as-is. In this example, I&#8217;ve used the simple table schema as defined in <a href=\"https:\/\/sqlite.land\/sqlite-browser\">this<\/a> article.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"using-html-mode\"><\/span>Using HTML mode<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>A good alternative is to change the SQLite output mode to HTML. As you may know, <a href=\"https:\/\/markdown.land\/markdown-table\">Markdown tables<\/a> can also be written in HTML, and sometimes, this is preferred because it gives you more options.<\/p>\n\n\n\n<p>To enable HTML output mode, all you need to do is enter the <code>.mode html<\/code> command in your <a href=\"https:\/\/sqlite.land\/sqlite-browser\" target=\"_blank\" rel=\"noreferrer noopener\">SQLite browser\/command prompt<\/a>. Here&#8217;s an example of this at work:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:false,&quot;languageLabel&quot;:false,&quot;fullScreenButton&quot;:false,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;sql&quot;,&quot;mime&quot;:&quot;text\/x-sql&quot;,&quot;theme&quot;:&quot;elegant&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;SQL&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;sql&quot;}\">sqlite&gt; .mode html\nsqlite&gt; select * from customers limit 2;\n&lt;TR&gt;&lt;TH&gt;name&lt;\/TH&gt;\n&lt;TH&gt;age&lt;\/TH&gt;\n&lt;\/TR&gt;\n&lt;TR&gt;&lt;TD&gt;Erik&lt;\/TD&gt;\n&lt;TD&gt;40&lt;\/TD&gt;\n&lt;\/TR&gt;\n&lt;TR&gt;&lt;TD&gt;Mary&lt;\/TD&gt;\n&lt;TD&gt;53&lt;\/TD&gt;\n&lt;\/TR&gt;<\/pre><\/div>\n\n\n\n<p>As you can see, you&#8217;ll get an almost complete HTML table. All you need to add are the HTML open and closing tags.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You&#8217;ve learned two output modes that you can use to export SQLite tables to either Markdown or to HTML. Depending on your needs, both output formats can be used in your Markdown file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re an SQLite user, exporting data from your queries directly to Markdown might be useful. This article shows you how to export SQLite queries to Markdown format. The good news is that you can do this with built-in SQLite features! Using SQLite&#8217;s Markdown mode By far the easiest method is to change the SQLite &#8230; <a title=\"SQLite Markdown: Format Query Results In Markdown\" class=\"read-more\" href=\"https:\/\/markdown.land\/sqlite-markdown\" aria-label=\"Read more about SQLite Markdown: Format Query Results In Markdown\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[2],"tags":[17],"class_list":["post-212","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-sqlite"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQLite Markdown: Format Query Results In Markdown - Markdown Land<\/title>\n<meta name=\"description\" content=\"Learn how to make SQLite queries output a format that can directly be used in Markdown files. You can use both Markdown or HTML for this.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/markdown.land\/sqlite-markdown\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQLite Markdown: Format Query Results In Markdown - Markdown Land\" \/>\n<meta property=\"og:description\" content=\"Learn how to make SQLite queries output a format that can directly be used in Markdown files. You can use both Markdown or HTML for this.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/markdown.land\/sqlite-markdown\" \/>\n<meta property=\"og:site_name\" content=\"Markdown Land\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-23T10:23:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-18T20:01:47+00:00\" \/>\n<meta name=\"author\" content=\"erik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"erik\" \/>\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\":\"TechArticle\",\"@id\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown\"},\"author\":{\"name\":\"erik\",\"@id\":\"https:\\\/\\\/markdown.land\\\/#\\\/schema\\\/person\\\/215ac80f110734348a1a9c7621f4c42c\"},\"headline\":\"SQLite Markdown: Format Query Results In Markdown\",\"datePublished\":\"2022-04-23T10:23:17+00:00\",\"dateModified\":\"2023-10-18T20:01:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown\"},\"wordCount\":262,\"publisher\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/#organization\"},\"keywords\":[\"sqlite\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown\",\"url\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown\",\"name\":\"SQLite Markdown: Format Query Results In Markdown - Markdown Land\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/#website\"},\"datePublished\":\"2022-04-23T10:23:17+00:00\",\"dateModified\":\"2023-10-18T20:01:47+00:00\",\"description\":\"Learn how to make SQLite queries output a format that can directly be used in Markdown files. You can use both Markdown or HTML for this.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/markdown.land\\\/sqlite-markdown\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/markdown.land\\\/sqlite-markdown#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/markdown.land\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQLite Markdown: Format Query Results In Markdown\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/markdown.land\\\/#website\",\"url\":\"https:\\\/\\\/markdown.land\\\/\",\"name\":\"Markdown Land\",\"description\":\"Your Markdown tutorial\",\"publisher\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/markdown.land\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/markdown.land\\\/#organization\",\"name\":\"Markdown Land\",\"url\":\"https:\\\/\\\/markdown.land\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/markdown.land\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/markdown.land\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/markdown-512px.png\",\"contentUrl\":\"https:\\\/\\\/markdown.land\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/markdown-512px.png\",\"width\":512,\"height\":339,\"caption\":\"Markdown Land\"},\"image\":{\"@id\":\"https:\\\/\\\/markdown.land\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/markdown.land\\\/#\\\/schema\\\/person\\\/215ac80f110734348a1a9c7621f4c42c\",\"name\":\"erik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8aafde648a2392ac69a0f79db75935e8f4dfa1c98af9cbd56416483631927b91?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8aafde648a2392ac69a0f79db75935e8f4dfa1c98af9cbd56416483631927b91?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8aafde648a2392ac69a0f79db75935e8f4dfa1c98af9cbd56416483631927b91?s=96&d=mm&r=g\",\"caption\":\"erik\"},\"sameAs\":[\"https:\\\/\\\/markdown.land\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQLite Markdown: Format Query Results In Markdown - Markdown Land","description":"Learn how to make SQLite queries output a format that can directly be used in Markdown files. You can use both Markdown or HTML for this.","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:\/\/markdown.land\/sqlite-markdown","og_locale":"en_US","og_type":"article","og_title":"SQLite Markdown: Format Query Results In Markdown - Markdown Land","og_description":"Learn how to make SQLite queries output a format that can directly be used in Markdown files. You can use both Markdown or HTML for this.","og_url":"https:\/\/markdown.land\/sqlite-markdown","og_site_name":"Markdown Land","article_published_time":"2022-04-23T10:23:17+00:00","article_modified_time":"2023-10-18T20:01:47+00:00","author":"erik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"erik","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/markdown.land\/sqlite-markdown#article","isPartOf":{"@id":"https:\/\/markdown.land\/sqlite-markdown"},"author":{"name":"erik","@id":"https:\/\/markdown.land\/#\/schema\/person\/215ac80f110734348a1a9c7621f4c42c"},"headline":"SQLite Markdown: Format Query Results In Markdown","datePublished":"2022-04-23T10:23:17+00:00","dateModified":"2023-10-18T20:01:47+00:00","mainEntityOfPage":{"@id":"https:\/\/markdown.land\/sqlite-markdown"},"wordCount":262,"publisher":{"@id":"https:\/\/markdown.land\/#organization"},"keywords":["sqlite"],"articleSection":["Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/markdown.land\/sqlite-markdown","url":"https:\/\/markdown.land\/sqlite-markdown","name":"SQLite Markdown: Format Query Results In Markdown - Markdown Land","isPartOf":{"@id":"https:\/\/markdown.land\/#website"},"datePublished":"2022-04-23T10:23:17+00:00","dateModified":"2023-10-18T20:01:47+00:00","description":"Learn how to make SQLite queries output a format that can directly be used in Markdown files. You can use both Markdown or HTML for this.","breadcrumb":{"@id":"https:\/\/markdown.land\/sqlite-markdown#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/markdown.land\/sqlite-markdown"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/markdown.land\/sqlite-markdown#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/markdown.land\/"},{"@type":"ListItem","position":2,"name":"SQLite Markdown: Format Query Results In Markdown"}]},{"@type":"WebSite","@id":"https:\/\/markdown.land\/#website","url":"https:\/\/markdown.land\/","name":"Markdown Land","description":"Your Markdown tutorial","publisher":{"@id":"https:\/\/markdown.land\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/markdown.land\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/markdown.land\/#organization","name":"Markdown Land","url":"https:\/\/markdown.land\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/markdown.land\/#\/schema\/logo\/image\/","url":"https:\/\/markdown.land\/wp-content\/uploads\/2021\/06\/markdown-512px.png","contentUrl":"https:\/\/markdown.land\/wp-content\/uploads\/2021\/06\/markdown-512px.png","width":512,"height":339,"caption":"Markdown Land"},"image":{"@id":"https:\/\/markdown.land\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/markdown.land\/#\/schema\/person\/215ac80f110734348a1a9c7621f4c42c","name":"erik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8aafde648a2392ac69a0f79db75935e8f4dfa1c98af9cbd56416483631927b91?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8aafde648a2392ac69a0f79db75935e8f4dfa1c98af9cbd56416483631927b91?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8aafde648a2392ac69a0f79db75935e8f4dfa1c98af9cbd56416483631927b91?s=96&d=mm&r=g","caption":"erik"},"sameAs":["https:\/\/markdown.land"]}]}},"modified_by":"erik","_links":{"self":[{"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/posts\/212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":3,"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":268,"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/posts\/212\/revisions\/268"}],"wp:attachment":[{"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/markdown.land\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}