{"id":213,"date":"2021-11-11T14:59:33","date_gmt":"2021-11-11T14:59:33","guid":{"rendered":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/?p=213"},"modified":"2021-11-11T15:11:58","modified_gmt":"2021-11-11T15:11:58","slug":"adding-data-to-a-table","status":"publish","type":"post","link":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/11\/adding-data-to-a-table\/","title":{"rendered":"Adding data to a table"},"content":{"rendered":"\n<p>To add data to a table, use the INSERT command. Let\u2019s see this in action by populating the table classics with the data.<\/p>\n\n\n\n<p>Example \ud83d\ude42 Populating the classics table<br>INSERT INTO classics(author, title, type, year)<br>VALUES(&#8216;Markku Aro&#8217;,&#8217;30 suosikkia&#8217;,&#8217;POP&#8217;,&#8217;1998&#8242;);<br>INSERT INTO classics(author, title, type, year)<br>VALUES(&#8216;Lenni Kalle&#8217;,&#8217;parhaat&#8217;,&#8217;klassikko&#8217;,&#8217;1811&#8242;);<br>INSERT INTO classics(author, title, type, year)<br>VALUES(&#8216;Esa M\u00e4kel\u00e4&#8221;,&#8217;Ketsuppia saksasta&#8217;,&#8217;POP&#8217;,&#8217;1990&#8242;);<br>INSERT INTO classics(author, title, type, year)<br>VALUES(&#8216;Matti ja Teppo&#8221;,&#8217;kautta aikain parhaat&#8217;,&#8217;iskelm\u00e4&#8217;,&#8217;1975&#8242;);<br>INSERT INTO classics(author, title, type, year)<br>VALUES(&#8216;Suvi Ter\u00e4sniska&#8217;,&#8217;30 parhainta &#8216;,&#8217;POP&#8217;,&#8217;2020&#8242;);<\/p>\n\n\n\n<p>After every second line, you should see a Query OK message. Once all lines have been entered, type the following command, which will display the table\u2019s contents.<\/p>\n\n\n\n<p>Use next command to read content:<br>SELECT * FROM classics;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To add data to a table, use the INSERT command. Let\u2019s see this in action by populating the table classics with the data. Example \ud83d\ude42 Populating the classics tableINSERT INTO classics(author, title, type, year)VALUES(&#8216;Markku Aro&#8217;,&#8217;30 suosikkia&#8217;,&#8217;POP&#8217;,&#8217;1998&#8242;);INSERT INTO classics(author, title, type, year)VALUES(&#8216;Lenni Kalle&#8217;,&#8217;parhaat&#8217;,&#8217;klassikko&#8217;,&#8217;1811&#8242;);INSERT INTO classics(author, title, type, year)VALUES(&#8216;Esa M\u00e4kel\u00e4&#8221;,&#8217;Ketsuppia saksasta&#8217;,&#8217;POP&#8217;,&#8217;1990&#8242;);INSERT INTO classics(author, title, type, year)VALUES(&#8216;Matti ja &hellip; <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/11\/adding-data-to-a-table\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Adding data to a table<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/213"}],"collection":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":3,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":218,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/213\/revisions\/218"}],"wp:attachment":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}