{"id":519,"date":"2023-10-16T21:23:59","date_gmt":"2023-10-16T21:23:59","guid":{"rendered":"https:\/\/bootstrap-it.com\/blog\/?p=519"},"modified":"2023-10-16T22:02:08","modified_gmt":"2023-10-16T22:02:08","slug":"how-to-perform-crud-operations-javascript-and-sql-example","status":"publish","type":"post","link":"https:\/\/bootstrap-it.com\/blog\/?p=519","title":{"rendered":"How to Perform CRUD Operations \u2013 JavaScript and SQL Example"},"content":{"rendered":"<div id=\"s-share-buttons\" class=\"horizontal-w-c-circular s-share-w-c\"><a href=\"http:\/\/www.facebook.com\/sharer.php?u=https:\/\/bootstrap-it.com\/blog\/?p=519\" target=\"_blank\" title=\"Share to Facebook\" class=\"s3-facebook hint--top\"><\/a><a href=\"http:\/\/twitter.com\/intent\/tweet?text=How to Perform CRUD Operations \u2013 JavaScript and SQL Example&url=https:\/\/bootstrap-it.com\/blog\/?p=519\" target=\"_blank\"  title=\"Share to Twitter\" class=\"s3-twitter hint--top\"><\/a><a href=\"http:\/\/reddit.com\/submit?url=https:\/\/bootstrap-it.com\/blog\/?p=519&title=How to Perform CRUD Operations \u2013 JavaScript and SQL Example\" target=\"_blank\" title=\"Share to Reddit\" class=\"s3-reddit hint--top\"><\/a><a href=\"http:\/\/www.linkedin.com\/shareArticle?mini=true&url=https:\/\/bootstrap-it.com\/blog\/?p=519\" target=\"_blank\" title=\"Share to LinkedIn\" class=\"s3-linkedin hint--top\"><\/a><a href=\"mailto:?Subject=How%20to%20Perform%20CRUD%20Operations%20\u2013%20JavaScript%20and%20SQL%20Example&Body=Here%20is%20the%20link%20to%20the%20article:%20https:\/\/bootstrap-it.com\/blog\/?p=519\" title=\"Email this article\" class=\"s3-email hint--top\"><\/a><\/div>\n<p>For the most part, interactive website architectures will involve generating or dispensing data of one sort or another. You can certainly use HTML forms to collect user input. But the kind of web form&nbsp;<a href=\"https:\/\/www.freecodecamp.org\/news\/creating-html-forms\/\">that&#8217;s described here<\/a>&nbsp;will only take you so far.<\/p>\n\n\n\n<p>What we really need is a way to reliably store and manipulate our data within the application environment.<\/p>\n\n\n\n<p>In this article, I&#8217;m going to show you how to connect a back end database to your data collection process. The plan involves tossing some HTML, JavaScript, and the tiny database engine SQLite into a bowl, mixing vigorously, and seeing what comes out.<\/p>\n\n\n\n<p>This article comes from&nbsp;<a href=\"https:\/\/www.udemy.com\/course\/complete-lpi-web-development-essentials-exam-study-guide\/?referralCode=C92570BCBB38302A9257\">my Complete LPI Web Development Essentials Study Guide course<\/a>. If you&#8217;d like, you can follow the video version here:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Working With Node.js and SQLite - LPI Web Development Essentials Study Guide\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/yf2RJmpMEiI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>As you may already know, the SQL in SQLite stands for&nbsp;<em>structured query language<\/em>. This means that the syntax you&#8217;ll use for interacting with a SQLite database will closely parallel how you&#8217;d do it with databases like MariaDB, Amazon Aurora, Oracle, or Microsoft&#8217;s SQL Server. If you&#8217;ve got experience with any of those, you&#8217;ll be right at home here.<\/p>\n\n\n\n<p>Why are we going to use SQLite here? Because it&#8217;s a very popular choice for the kind of work you&#8217;re likely to undertake in a web environment.<\/p>\n\n\n\n<p>You&#8217;ll need to create a new directory on your machine along with some files with JavaScript code. We&#8217;ll learn how to create, modify, and delete records in a SQLite database.<\/p>\n\n\n\n<p>I could incorporate all those actions into a single file, of course, but I think breaking them out into multiple files will make it easier to understand what&#8217;s going on.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"connecting-to-a-database-and-creating-a-table\">Connecting to a Database and Creating a Table<\/h2>\n\n\n\n<p>Here&#8217;s what the first file will look like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const sqlite3 = require('sqlite3').verbose();\n\n\/\/ Create\/connect to the database\nconst db = new sqlite3.Database('mydatabase.db');\n\n\/\/ Create a table\ndb.run(`CREATE TABLE IF NOT EXISTS users (\n    id INTEGER PRIMARY KEY,\n    name TEXT,\n    age INTEGER\n)`);\n\n\/\/ Insert data\nconst insertQuery = `INSERT INTO users (name, age) VALUES (?, ?)`;\nconst name = 'Trevor';\nconst age = 5;\ndb.run(insertQuery, &#91;name, age], function (err) {\n    if (err) {\n        console.error(err.message);\n    } else {\n        console.log(`Inserted data with id ${this.lastID}`);\n    }\n});\n\n\/\/ Close the database connection\ndb.close();<\/code><\/pre>\n\n\n\n<p>We begin by loading the sqlite3 module as&nbsp;<code>sqlite3<\/code>&nbsp;and then creating the&nbsp;<code>db<\/code>&nbsp;variable to represent our new database instance. The database will be called&nbsp;<code>mydatabase.db<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const sqlite3 = require('sqlite3').verbose();\nconst db = new sqlite3.Database('mydatabase.db');<\/code><\/pre>\n\n\n\n<p>If there isn&#8217;t a database using that name in our local directory, the code will create one, otherwise it&#8217;ll just connect to the one that&#8217;s there already.<\/p>\n\n\n\n<p>Since this is our first run, I&#8217;ll create a new table within the&nbsp;<code>mydatabase.db<\/code>&nbsp;database. There will be three keys in our table:&nbsp;<code>id<\/code>,&nbsp;<code>name<\/code>, and&nbsp;<code>age<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>db.run(`CREATE TABLE IF NOT EXISTS users (\n    id INTEGER PRIMARY KEY,\n    name TEXT,\n    age INTEGER\n)`);<\/code><\/pre>\n\n\n\n<p>As you can see,&nbsp;<code>id<\/code>&nbsp;will be the primary key that we&#8217;ll use to reference individual records.<\/p>\n\n\n\n<p>We defined the data type of each key: integer, text and, again, integer. This definition is something we only need to do once. But we do want to get it right, because changing it later, after we&#8217;ve already added data, can be tricky.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inserting-new-data-into-a-table\">Inserting New Data into a Table<\/h2>\n\n\n\n<p>In this section, we&#8217;ll will add a new record to the table using the SQL&nbsp;<code>INSERT<\/code>&nbsp;command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const insertQuery = `INSERT INTO users (name, age) VALUES (?, ?)`;\nconst name = 'Trevor';\nconst age = 5;\ndb.run(insertQuery, &#91;name, age], function (err) {\n    if (err) {\n        console.error(err.message);\n    } else {\n        console.log(`Inserted data with id ${this.lastID}`);\n    }\n});<\/code><\/pre>\n\n\n\n<p>You&#8217;ll probably discover that official SQL documentation always capitalizes key syntax terms like&nbsp;<code>INSERT<\/code>&nbsp;and&nbsp;<code>SELECT<\/code>. That&#8217;s a useful best practice, but it&#8217;s not actually necessary. As a rule, I&#8217;m way too lazy to bother.<\/p>\n\n\n\n<p>The query itself is templated as&nbsp;<code>insertQuery<\/code>, with the&nbsp;<code>name<\/code>&nbsp;and&nbsp;<code>age<\/code>&nbsp;details added as constants in the lines that follow.<\/p>\n\n\n\n<p>The&nbsp;<code>db.run<\/code>&nbsp;method, using the&nbsp;<code>insertQuery<\/code>&nbsp;constant and those two values (<code>name<\/code>&nbsp;and&nbsp;<code>age<\/code>) as attributes, is then executed. Based on the success or failure of the operation, log messages will be generated.<\/p>\n\n\n\n<p>But hang on for a moment. What&#8217;s with those question marks after declaring&nbsp;<code>insertQuery<\/code>? And why did we need to break this process into two parts?<\/p>\n\n\n\n<p>This is actually an important security practice known as an escape variable. With this in place, when the&nbsp;<code>db.run()<\/code>&nbsp;method executes the prepared statement, it&#8217;ll automatically handle the escaping of the variable value, preventing SQL injection.<\/p>\n\n\n\n<p>Lastly, we close down the connection:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>db.close();<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"modifying-data\">Modifying Data<\/h2>\n\n\n\n<p>Now let&#8217;s see how the &#8220;modify&#8221; code works. Like before, we create a SQLite3 constant and then connect to our database.<\/p>\n\n\n\n<p>This time, however, our table already exists, so we can go straight to the &#8220;modify&#8221; section.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const sqlite3 = require('sqlite3').verbose();\n\n\/\/ Create\/connect to the database\nconst db = new sqlite3.Database('mydatabase.db');\n\n\/\/ Modify data\nconst updateQuery = `UPDATE users SET age = ? WHERE name = ?`;\nconst updatedAge = 30;\nconst updatedName = 'name2';\ndb.run(updateQuery, &#91;updatedAge, updatedName], function (err) {\n    if (err) {\n        console.error(err.message);\n    } else {\n        console.log(`Modified ${this.changes} row(s)`);\n    }\n});\n\n\/\/ Close the database connection\ndb.close();<\/code><\/pre>\n\n\n\n<p>The pattern is similar. We define an&nbsp;<code>updateQuery<\/code>&nbsp;method to&nbsp;<code>UPDATE<\/code>&nbsp;a record that we&#8217;ll define. This operation will change the&nbsp;<code>age<\/code>&nbsp;value for an entry whose name equals&nbsp;<code>Trevor<\/code>.<\/p>\n\n\n\n<p>You may recall that Trevor&#8217;s age was earlier listed as 25. We&#8217;re going to update that to 30. Everything else will work the same as before, including closing the connection when we&#8217;re done.<\/p>\n\n\n\n<p>This section of code from the third file will delete a record:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const deleteQuery = `DELETE FROM users WHERE name = ?`;\nconst deletedName = 'name1';\ndb.run(deleteQuery, &#91;deletedName], function (err) {\n    if (err) {\n        console.error(err.message);\n    } else {\n        console.log(`Deleted ${this.changes} row(s)`);\n    }\n});\n<\/code><\/pre>\n\n\n\n<p>The code above will delete the record where the name equals&nbsp;<code>Trevor<\/code>.<\/p>\n\n\n\n<p>You can run any of those files using the&nbsp;<code>node<\/code>&nbsp;&nbsp;command. But you should first make sure that you&#8217;ve installed the&nbsp;<code>sqlite3<\/code>&nbsp;module:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ npm install sqlite3<\/code><\/pre>\n\n\n\n<p>Next I&#8217;ll use&nbsp;<code>node<\/code>&nbsp;to run the first file (that you could choose to call&nbsp;<code>db.js<\/code>).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ node db.js\nInserted data with id 1<\/code><\/pre>\n\n\n\n<p>We&#8217;ll see that a new record has been successfully inserted. If you list the directory contents, you&#8217;ll also see that a new&nbsp;<code>mydatabase.db<\/code>&nbsp;file has been created.<\/p>\n\n\n\n<p>You can always manually log into sqlite3 to see how things might have changed. I&#8217;ll reference the&nbsp;<code>mydatabase.db<\/code>&nbsp;file so we can open it up right away.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sqlite3 mydatabase.db<\/code><\/pre>\n\n\n\n<p>Typing&nbsp;<code>.tables<\/code>&nbsp;within the SQLite interface will list all the existing tables in this database. In our case, it&#8217;ll be the&nbsp;<code>users<\/code>&nbsp;table we created.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlite&gt; .tables\nusers\nsqlite&gt;<\/code><\/pre>\n\n\n\n<p>Now I&#8217;ll use the SQL&nbsp;<code>select<\/code>&nbsp;command to display a record. Here I&#8217;ll use the asterisk to represent all records and specify the&nbsp;<code>users<\/code>&nbsp;table.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sqlite&gt; SELECT * FROM users;\n1|Trevor|25\nsqlite&gt;<\/code><\/pre>\n\n\n\n<p>We can see that record&nbsp;<code>1<\/code>&nbsp;containing&nbsp;<code>Trevor<\/code>&nbsp;who is 25 years old has been created. Great!<\/p>\n\n\n\n<p>Finally, we can run the&nbsp;<code>delete<\/code>&nbsp;code which should remove Trevor altogether:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const deleteQuery = `DELETE FROM users WHERE name = ?`;\nconst deletedName = 'Trevor';\ndb.run(deleteQuery, &#91;deletedName], function (err) {\n    if (err) {\n        console.error(err.message);\n    } else {\n        console.log(`Deleted ${this.changes} row(s)`);\n    }\n});<\/code><\/pre>\n\n\n\n<p>I should note that the&nbsp;<code>db.run<\/code>&nbsp;and&nbsp;<code>db.close<\/code>&nbsp;format I used for those methods can also be referred to as&nbsp;<code>Database.run()<\/code>, and&nbsp;<code>database.close()<\/code>. It&#8217;s just a matter of preference &#8211; or, in my case, laziness. I&#8217;m a Linux admin, after all, and the very best admins are, in principle, lazy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"summary\">Summary<\/h2>\n\n\n\n<p>We&#8217;ve seen how use JavaScript to connect to a back end database, create a new table, and then add, modify, and delete records in that table. And we seem to have gotten away with it, too!<\/p>\n\n\n\n<p>Now try this on your own computer. But play around with the values. Even better: build something practical.<\/p>\n\n\n\n<p><em>This article comes from&nbsp;<a href=\"https:\/\/www.udemy.com\/course\/complete-lpi-web-development-essentials-exam-study-guide\/?referralCode=C92570BCBB38302A9257\">my Complete LPI Web Development Essentials Study Guide course<\/a>.&nbsp;And there&#8217;s much more technology goodness available at&nbsp;<a href=\"https:\/\/bootstrap-it.com\/\">bootstrap-it.com<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>For the most part, interactive website architectures will involve generating or dispensing data of one sort or another. You can certainly use HTML forms to collect user input. But the kind of web form&nbsp;that&#8217;s described here&nbsp;will only take you so&hellip; <a href=\"https:\/\/bootstrap-it.com\/blog\/?p=519\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":443,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-519","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Perform CRUD Operations \u2013 JavaScript and SQL Example - Bootstrap IT<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/bootstrap-it.com\/blog\/?p=519\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Perform CRUD Operations \u2013 JavaScript and SQL Example - Bootstrap IT\" \/>\n<meta property=\"og:description\" content=\"For the most part, interactive website architectures will involve generating or dispensing data of one sort or another. You can certainly use HTML forms to collect user input. But the kind of web form&nbsp;that&#8217;s described here&nbsp;will only take you so&hellip; Continue Reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/bootstrap-it.com\/blog\/?p=519\" \/>\n<meta property=\"og:site_name\" content=\"Bootstrap IT\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-16T21:23:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-16T22:02:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/bootstrap-it.com\/blog\/wp-content\/uploads\/digital-information.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"853\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"dbclin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@davidbclinton\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dbclin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/?p=519\",\"url\":\"https:\/\/bootstrap-it.com\/blog\/?p=519\",\"name\":\"How to Perform CRUD Operations \u2013 JavaScript and SQL Example - Bootstrap IT\",\"isPartOf\":{\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#website\"},\"datePublished\":\"2023-10-16T21:23:59+00:00\",\"dateModified\":\"2023-10-16T22:02:08+00:00\",\"author\":{\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec\"},\"breadcrumb\":{\"@id\":\"https:\/\/bootstrap-it.com\/blog\/?p=519#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/bootstrap-it.com\/blog\/?p=519\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/?p=519#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/bootstrap-it.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Perform CRUD Operations \u2013 JavaScript and SQL Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#website\",\"url\":\"https:\/\/bootstrap-it.com\/blog\/\",\"name\":\"Bootstrap IT\",\"description\":\"Learn technology using technology\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/bootstrap-it.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec\",\"name\":\"dbclin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g\",\"caption\":\"dbclin\"},\"sameAs\":[\"http:\/\/bootstrap-it.com\/\",\"dbclinton\",\"https:\/\/twitter.com\/davidbclinton\"],\"url\":\"https:\/\/bootstrap-it.com\/blog\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Perform CRUD Operations \u2013 JavaScript and SQL Example - Bootstrap IT","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:\/\/bootstrap-it.com\/blog\/?p=519","og_locale":"en_US","og_type":"article","og_title":"How to Perform CRUD Operations \u2013 JavaScript and SQL Example - Bootstrap IT","og_description":"For the most part, interactive website architectures will involve generating or dispensing data of one sort or another. You can certainly use HTML forms to collect user input. But the kind of web form&nbsp;that&#8217;s described here&nbsp;will only take you so&hellip; Continue Reading &rarr;","og_url":"https:\/\/bootstrap-it.com\/blog\/?p=519","og_site_name":"Bootstrap IT","article_published_time":"2023-10-16T21:23:59+00:00","article_modified_time":"2023-10-16T22:02:08+00:00","og_image":[{"width":1280,"height":853,"url":"https:\/\/bootstrap-it.com\/blog\/wp-content\/uploads\/digital-information.jpg","type":"image\/jpeg"}],"author":"dbclin","twitter_card":"summary_large_image","twitter_creator":"@davidbclinton","twitter_misc":{"Written by":"dbclin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/bootstrap-it.com\/blog\/?p=519","url":"https:\/\/bootstrap-it.com\/blog\/?p=519","name":"How to Perform CRUD Operations \u2013 JavaScript and SQL Example - Bootstrap IT","isPartOf":{"@id":"https:\/\/bootstrap-it.com\/blog\/#website"},"datePublished":"2023-10-16T21:23:59+00:00","dateModified":"2023-10-16T22:02:08+00:00","author":{"@id":"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec"},"breadcrumb":{"@id":"https:\/\/bootstrap-it.com\/blog\/?p=519#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/bootstrap-it.com\/blog\/?p=519"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/bootstrap-it.com\/blog\/?p=519#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/bootstrap-it.com\/blog"},{"@type":"ListItem","position":2,"name":"How to Perform CRUD Operations \u2013 JavaScript and SQL Example"}]},{"@type":"WebSite","@id":"https:\/\/bootstrap-it.com\/blog\/#website","url":"https:\/\/bootstrap-it.com\/blog\/","name":"Bootstrap IT","description":"Learn technology using technology","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/bootstrap-it.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/ae0fb1d5b3b01558b92b6426d77766ec","name":"dbclin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/bootstrap-it.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a93785d437350478a7f1dfcbec58d26bc28e0124e405179acbe1b4325c09f90a?s=96&d=mm&r=g","caption":"dbclin"},"sameAs":["http:\/\/bootstrap-it.com\/","dbclinton","https:\/\/twitter.com\/davidbclinton"],"url":"https:\/\/bootstrap-it.com\/blog\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=519"}],"version-history":[{"count":2,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/519\/revisions\/522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/443"}],"wp:attachment":[{"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bootstrap-it.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}