{"id":1071,"date":"2018-10-20T08:12:23","date_gmt":"2018-10-19T23:12:23","guid":{"rendered":"https:\/\/yuis-programming.com\/?p=1071"},"modified":"2021-10-28T17:32:30","modified_gmt":"2021-10-28T08:32:30","slug":"sql%e3%81%a7wordpress%e3%81%ae%e8%a8%98%e4%ba%8b%e3%82%92%e6%ad%a3%e8%a6%8f%e8%a1%a8%e7%8f%be%e6%a4%9c%e7%b4%a2%e3%81%97%e3%81%a6markdown%e5%bd%a2%e5%bc%8f%e3%81%ab%e3%81%99%e3%82%8b-%e7%b0%a1","status":"publish","type":"post","link":"https:\/\/yuis-programming.com\/?p=1071","title":{"rendered":"SQL\u3067WordPress\u306e\u8a18\u4e8b\u3092\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3057\u3066\u30de\u30fc\u30af\u30c0\u30a6\u30f3\u3067\u30b3\u30d4\u30fc"},"content":{"rendered":"<p>SQL\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067WordPress\u30d6\u30ed\u30b0\u30fb\u30b5\u30a4\u30c8\u306e\u8a18\u4e8b\u3092\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3057\u3066\u30de\u30fc\u30af\u30c0\u30a6\u30f3\u5f62\u5f0f(MarkDown)\u3067\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002\u7c21\u5358\u306bWordPress\u30d6\u30ed\u30b0\u306e\u8a18\u4e8b\u30ea\u30f3\u30af\u3092\u4e00\u6c17\u306b\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3068\u3057\u3066\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p>(2021\u5e74\u306b\u4e00\u90e8\u66f4\u65b0\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u5c11\u3057\u30ed\u30b8\u30c3\u30af\u304c\u7121\u99c4\u306b\u8907\u96d1\u904e\u304e\u307e\u3059\u306d\u3002\u3084\u3063\u3066\u308b\u3053\u3068\u306f\u5fae\u5999\u306b\u9ad8\u5ea6\u306a\u306e\u3067\u3059\u304c\u6210\u679c\u7269\u304c\u3057\u3087\u307c\u3044\u6c17\u304c\u3059\u308b\u2026\u79c1\u306f\u30d6\u30e9\u30a6\u30b6\u306e\u30b5\u30a4\u30c8\u4e0a\u3067ctrl-m\u306e\u30b7\u30e7\u30fc\u30c8\u30ab\u30c3\u30c8\u30ad\u30fc\u3067\u30de\u30fc\u30af\u30c0\u30a6\u30f3\u5f62\u5f0f\u3067URL\u30fb\u30bf\u30a4\u30c8\u30eb\u304c\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3055\u308c\u308btampermonkey\u306eJavaScript\u30e6\u30fc\u30b6\u30fc\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u968f\u5206\u524d\u306b\u66f8\u3044\u3066\u3001\u5185\u90e8\u30ea\u30f3\u30af\u306e\u7de8\u96c6\u304c\u5fc5\u8981\u306a\u3068\u304d\u306f\u30de\u30cb\u30e5\u30a2\u30eb\u3067\u3084\u3063\u3066\u3044\u307e\u3059\u3002simple is the best\u3068\u3044\u3046\u8a00\u8449\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u672c\u5f53\u306b\u305d\u306e\u3068\u304a\u308a\u3067\u3059\u3002)<\/p>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/data\/GIF_urIHcAtjj3QgdqTgOP8kg8cBRms8GmPn.gif\" alt=\"https:\/\/yuis.xsrv.jp\/data\/GIF_urIHcAtjj3QgdqTgOP8kg8cBRms8GmPn.gif\"><\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#i\"><span class=\"toc_number toc_depth_1\">1<\/span> \u524d\u66f8\u304d<\/a><\/li><li><a href=\"#i-2\"><span class=\"toc_number toc_depth_1\">2<\/span> \u6e96\u5099<\/a><\/li><li><a href=\"#WordPressURL\"><span class=\"toc_number toc_depth_1\">3<\/span> WordPress\u306e\u8a18\u4e8b\u3092\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3057\u3066\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u30b3\u30d4\u30da\u3059\u308b<\/a><\/li><li><a href=\"#CSVMarkDown\"><span class=\"toc_number toc_depth_1\">4<\/span> CSV\u3092MarkDown\u5f62\u5f0f\u306b\u3059\u308b<\/a><\/li><li><a href=\"#i-3\"><span class=\"toc_number toc_depth_1\">5<\/span> \u307e\u3068\u3081<\/a><\/li><\/ul><\/div>\n<h2><span id=\"i\">\u524d\u66f8\u304d<\/span><\/h2>\n<p>WordPress\u3067\u30d6\u30ed\u30b0\u66f8\u3044\u3066\u3066\u3044\u3064\u3082\u601d\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u3066\u3001<\/p>\n<p>&#8220;\u5185\u90e8\u30ea\u30f3\u30af\u5168\u304f\u3057\u3066\u306a\u3044\u306a\u30fc\u2026\u2026&#8221;\u3068\u3002<\/p>\n<p>\u5185\u90e8\u30ea\u30f3\u30af\u306fSEO\u7684\u306b\u3082\u7d50\u69cb\u91cd\u8981\u306a\u8981\u7d20\u3067\u3057\u3066\u3001\u4f8b\u3048\u3070\u3001&#8221;\u3053\u3061\u3089\u306e\u8a18\u4e8b\u3067\u3053\u308c\u306b\u3064\u3044\u3066\u306f\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\uff1a[URL]&#8221;\u307f\u305f\u3044\u306a\u6587\u7ae0\u3092\u66f8\u3044\u305f\u3068\u3057\u3066\u3001\u3053\u306eURL\u304c\u30af\u30ea\u30c3\u30af\u3055\u308c\u307e\u304f\u308b\u3068\u3001\u3053\u306eURL\u306eSEO\u306f\u4e0a\u304c\u308b\u3093\u3067\u3059\u306d\u3002<br \/>\n\u3067\u3082\u3001\u3053\u3046\u3044\u3046\u3053\u3068\u3092\u3059\u308b\u306e\u3063\u3066\u3001\u7d50\u69cb\u52b4\u529b\u304c\u304b\u304b\u308b\u3082\u306e\u3067\u3059\u3002<br \/>\n\u666e\u901a\u306b\u3084\u308d\u3046\u3068\u3057\u305f\u3089\u3001WordPress\u306e\u30b5\u30a4\u30c8\u306b\u884c\u3063\u3066\u3001\u691c\u7d22\u7a93\u304b\u3089\u95a2\u9023\u3057\u3066\u305d\u3046\u306a\u8a18\u4e8b\u3092\u63a2\u3059\u3079\u304f\u6587\u5b57\u5217\u3092\u5165\u529b\u3057\u3066\u691c\u7d22\u3057\u3066\u3001\u51fa\u3066\u304d\u305f\u8a18\u4e8b\u3092\u958b\u3044\u3066\u3001\u305d\u306e\u8a18\u4e8b\u304c\u95a2\u9023\u3057\u3066\u3044\u308b\u8a18\u4e8b\u3060\u3063\u305f\uff0f\u7d39\u4ecb\u3057\u305f\u3044\u8a18\u4e8b\u3060\u3063\u305f\u5834\u5408\u306b\u306f\u305d\u306eURL\u3092\u30b3\u30d4\u30fc\u3057\u3066\u3001\u30bf\u30a4\u30c8\u30eb\u3082\u30b3\u30d4\u30fc\u3057\u3066\u3001Markdown\u5f62\u5f0f\u306b\u3057\u3066\u3001\u30c6\u30ad\u30b9\u30c8\u30a8\u30c7\u30a3\u30bf\u306b\u30da\u30fc\u30b9\u30c8\u3057\u3066\u3084\u3063\u3068\u5b8c\u6210\u3059\u308b\u308f\u3051\u3067\u3059\u3002\u8efd\u304f\uff13\u5206\u4ee5\u4e0a\u304b\u304b\u308a\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u306a\u306e\u3067\u50d5\u306f\u4eca\u307e\u3067\u3001\u3053\u3046\u3044\u3046\u5185\u90e8\u30ea\u30f3\u30af\u7684\u306a\u4f5c\u696d\u306f\u5168\u304f\u7121\u8996\u3057\u3066\u3044\u305f\u3093\u3067\u3059\u304c\u3001\u6700\u8fd1\u30e1\u30a4\u30f3\u30d6\u30ed\u30b0\u53ca\u3073\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u30d6\u30ed\u30b0\u306e\u65b9\u3082\u7d50\u69cb\u898b\u3066\u304f\u3060\u3055\u308b\u65b9\u304c\u591a\u304f\u306a\u3063\u3066\u304d\u305f\u306e\u3067\u3001\u3082\u3046\u5c11\u3057\u8a18\u4e8b\u306e\u8cea\u3092\u4e0a\u3052\u305f\u3044\u306a(\u3093\u3067\u3082\u3063\u3066SEO\u3082\u4e0a\u3052\u305f\u3044\u306a)\u3068\u601d\u3063\u305f\u6b21\u7b2c\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2><span id=\"i-2\">\u6e96\u5099<\/span><\/h2>\n<p>mysql workbench\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/yuis-programming.com\/?p=566\">Windows10\u3067Mysql\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u300cWorkbench\u300d\u3092\u4f7f\u3046<\/a><br \/>\n<a href=\"https:\/\/yuis-programming.com\/?p=564\">Workbench\u3067xserver\u306eMysql\u306b\u63a5\u7d9a\u3059\u308b\u65b9\u6cd5<\/a><\/p>\n<p>(\u2191\u3053\u3061\u3089\u306f\u521d\u3081\u3066\u3053\u306e\u7406\u8ad6\u3067\u4f5c\u6210\u3057\u305fMarkDown\u306b\u306a\u308a\u307e\u3059\u3002\u6211\u306a\u304c\u3089\u4fbf\u5229\u3059\u304e\u308b\u2026\u2026\u2026\u3002\u601d\u3044\u3064\u3044\u3066\u304b\u3089\u30ea\u30f3\u30af\u3092\u8cbc\u308b\u307e\u3067\u306b20\u79d2\u3068\u304b\u304b\u308a\u307e\u305b\u3093\uff01)<\/p>\n<p>\u521d\u6b69\u7684\u306a\u3053\u3068\u3067\u3059\u304c\u3001SQL\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u64cd\u4f5c\u3057\u307e\u3059\u306e\u3067\u3001WordPress\u3092\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d0\u30fc\u306bworkbench\u304b\u3089\u63a5\u7d9a\u3057\u3066\u3084\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2><span id=\"WordPressURL\">WordPress\u306e\u8a18\u4e8b\u3092\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3057\u3066\u30bf\u30a4\u30c8\u30eb\u3068URL\u3092\u30b3\u30d4\u30da\u3059\u308b<\/span><\/h2>\n<p>\u307e\u305a\u3001workbench\u306e\u4ed5\u69d8\u3068\u3057\u3066\u3001\u2026\u307e\u3041\u8aac\u660e\u3057\u3060\u3059\u3068\u30ad\u30ea\u304c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u4f7f\u7528\u3059\u308b\u4ed5\u69d8\u3068\u3057\u3066\u306f\u3001select\u3067\u51fa\u529b\u3057\u305f\u30c6\u30fc\u30d6\u30eb\u306e\u30ec\u30b3\u30fc\u30c9\u3092CSV\u5f62\u5f0f\u3067\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3063\u3066\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>e.g.<\/p>\n<pre><code>'Windows10\u3067Mysql\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u300cWorkbench\u300d\u3092\u4f7f\u3046', 'https:\/\/yuis-programming.com\/?p=566'\n'Workbench\u3067xserver\u306eMysql\u306b\u63a5\u7d9a\u3059\u308b\u65b9\u6cd5', 'https:\/\/yuis-programming.com\/?p=564'\n<\/code><\/pre>\n<p>\u3053\u308c\u3092\u51fa\u529b\u3059\u308b\u305f\u3081\u306b\u3001\u4ee5\u4e0b\u306eSQL\u3092workbench\u306b\u8cbc\u308a\u4ed8\u3051\u3066\u5b9f\u884c\u3057\u307e\u3059\u3002(ctrl+Enter)<\/p>\n<p>SQL\u306f\u3068\u3066\u3082\u7c21\u5358\u3067\u3059\u3002<\/p>\n<pre><code>USE yuis_programming2 ; # \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\n\nselect post_title, guid from wp_posts\n    where (post_type='post' OR post_type='page')\n        AND (post_status='publish' OR post_status='future')\n        AND (post_author='1')\n        AND post_title REGEXP \"ruby\"\n        AND post_content REGEXP \".\"\n    order by post_date desc\n            ;        \n<\/code><\/pre>\n<p>\u4e0a\u306e\u4f8b\u3067\u306f\u3001\u8a18\u4e8b\u30bf\u30a4\u30c8\u30eb\u306b\u5bfe\u3057\u3066&#8221;ruby&#8221;\u3067\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u8a18\u4e8b\u30bf\u30a4\u30c8\u30eb\u306b&#8221;ruby&#8221;\u3092\u542b\u3080\u8a18\u4e8b\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<br \/>\n\u540c\u3058\u304f\u3001post_content\u304c\u672c\u6587\u3067\u3059\u306e\u3067\u3001\u672c\u6587\u306b\u5bfe\u3057\u3066\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3092\u3057\u3066\u3084\u308b\u3053\u3068\u3082\u3082\u3061\u308d\u3093\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u3067\u51fa\u529b\u7d50\u679c\u306f\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_fe85f646-c555-49f7-83fc-e1c98d95f4dd.png\" alt=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_fe85f646-c555-49f7-83fc-e1c98d95f4dd.png\"><\/p>\n<p>\u3067\u3001markdown\u304c\u307b\u3057\u3044\u8a18\u4e8b\u3092\u9078\u629e\u3057\u3066\u3001\u3053\u3053\u304b\u3089\u3001copy row\u3092\u3057\u3066\u3001\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<p><img src=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_50d99407-1cab-4d7b-8773-f3bc765e221e.png\" alt=\"https:\/\/yuis.xsrv.jp\/images\/ss\/ShareX_ScreenShot_50d99407-1cab-4d7b-8773-f3bc765e221e.png\"><\/p>\n<p>\u3053\u308c\u3067\u3001\u5148\u7a0b\u306eCSV\u304c\u30b3\u30d4\u30fc\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<h2><span id=\"CSVMarkDown\">CSV\u3092MarkDown\u5f62\u5f0f\u306b\u3059\u308b<\/span><\/h2>\n<p>\u3067\u306f\u3001\u7d9a\u3044\u3066\u30b3\u30d4\u30fc\u3057\u305fCSV\u3092MarkDown\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>WSL bash\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u3092.bashrc\u306b\u5165\u308c\u308b\u304b\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u30da\u30fc\u30b9\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>(| clip.exe\u3063\u3066\u3068\u3053\u308d\u304c\u3001windows\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3063\u3066\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3053\u3089\u3078\u3093\u306fubuntu\u3084\u3089mac\u3084\u3089\u3067\u305d\u308c\u305e\u308c\u30b3\u30d4\u30fc\u30b3\u30de\u30f3\u30c9\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u305d\u308c\u306b\u5909\u3048\u3066\u304f\u3060\u3055\u3044\u306d\u3002)<\/p>\n<pre><code>\nsqlToMarkdown(){\n  cat &gt; \/tmp\/sqlToMarkdown.txt\n  sed -Ei \"s\/'(.*)',\\s?'(.*)'\/\\[\\1\\]\\(\\2\\)\/g\" \/tmp\/sqlToMarkdown.txt\n  sed -Ei 's\/\\\\\"\/\"\/g' \/tmp\/sqlToMarkdown.txt\n  cat \/tmp\/sqlToMarkdown.txt | clip.exe\n}\n\nalias sqlmd='sqlToMarkdown'\n\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u3001sqlmd\u3092\u5b9f\u884c\u3057\u305f\u5f8c\u3001ctrl+V\u3067\u30da\u30fc\u30b9\u30c8\u3057\u307e\u3059\u3002<\/p>\n<pre><code>$ sqlmd\n'Windows10\u3067Mysql\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u300cWorkbench\u300d\u3092\u4f7f\u3046', 'https:\/\/yuis-programming.com\/?p=566'\n'Workbench\u3067xserver\u306eMysql\u306b\u63a5\u7d9a\u3059\u308b\u65b9\u6cd5', 'https:\/\/yuis-programming.com\/?p=564'\n\n$\n<\/code><\/pre>\n<p>\u3059\u308b\u3068\u2026<\/p>\n<pre><code>[Windows10\u3067Mysql\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u300cWorkbench\u300d\u3092\u4f7f\u3046](https:\/\/yuis-programming.com\/?p=566)\n[Workbench\u3067xserver\u306eMysql\u306b\u63a5\u7d9a\u3059\u308b\u65b9\u6cd5](https:\/\/yuis-programming.com\/?p=564)\n\n<\/code><\/pre>\n<p>\u306a\u3093\u3068\uff01MarkDown\u304c\u51fa\u6765\u4e0a\u304c\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u306d\uff01<\/p>\n<h2><span id=\"i-3\">\u307e\u3068\u3081<\/span><\/h2>\n<p>\u3053\u308c\u3067\u5185\u90e8\u30ea\u30f3\u30af\u5bfe\u7b56\u304c\u6357\u308b\u3088\uff01\u3084\u3063\u305f\u306d\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3067WordPress\u30d6\u30ed\u30b0\u30fb\u30b5\u30a4\u30c8\u306e\u8a18\u4e8b\u3092\u6b63\u898f\u8868\u73fe\u691c\u7d22\u3057\u3066\u30de\u30fc\u30af\u30c0\u30a6\u30f3\u5f62\u5f0f(MarkD [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"acf":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8Rxwo-hh","_links":{"self":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1071"}],"collection":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1071"}],"version-history":[{"count":3,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1071\/revisions"}],"predecessor-version":[{"id":3229,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/1071\/revisions\/3229"}],"wp:attachment":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}