{"id":255,"date":"2021-11-18T11:36:38","date_gmt":"2021-11-18T11:36:38","guid":{"rendered":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/?p=255"},"modified":"2021-11-18T11:36:38","modified_gmt":"2021-11-18T11:36:38","slug":"querying-a-mysql-database","status":"publish","type":"post","link":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/18\/querying-a-mysql-database\/","title":{"rendered":"Querying a MySQL Database"},"content":{"rendered":"\n<p>So far, we\u2019ve created a MySQL database and tables, populated them with data, and added indexes to make them fast to search. Now it\u2019s time to look at how these searches are performed, and the various commands and qualifiers available. <br><br>SELECT command is used to extract data from a table. In<br>that section, I used its simplest form to select all data and display it\u2014something you will never want to do on anything but the smallest tables, because all the data will scroll by at an unreadable pace. Alternatively, on Unix\/Linux computers, you can tell MySQL to page output a screen at a time by issuing the command:<br><strong>pager less;<\/strong><\/p>\n\n\n\n<p>This pipes output to the less program. To restore standard output and turn paging off, you can issue this command:<br><strong>nopager;<\/strong><\/p>\n\n\n\n<p>Let\u2019s now examine SELECT in more detail. The basic syntax is:<br><strong>SELECT something FROM tablename;<\/strong><\/p>\n\n\n\n<p>Two different SELECT statements:<\/p>\n\n\n\n<p><strong>SELECT author,title FROM classics;<br>SELECT title,isbn FROM classics;<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So far, we\u2019ve created a MySQL database and tables, populated them with data, and added indexes to make them fast to search. Now it\u2019s time to look at how these searches are performed, and the various commands and qualifiers available. SELECT command is used to extract data from a table. Inthat section, I used its &hellip; <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2021\/11\/18\/querying-a-mysql-database\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Querying a MySQL Database<\/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\/255"}],"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=255"}],"version-history":[{"count":1,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":256,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/255\/revisions\/256"}],"wp:attachment":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}