{"id":1905,"date":"2019-04-23T14:56:05","date_gmt":"2019-04-23T06:56:05","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=1905"},"modified":"2020-12-02T14:57:34","modified_gmt":"2020-12-02T06:57:34","slug":"%e8%a7%86%e5%9b%be%e7%9a%84%e7%ae%80%e5%8d%95%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/database\/2019\/04\/23\/1456051905.html","title":{"rendered":"\u89c6\u56fe\u7684\u7b80\u5355\u4f7f\u7528"},"content":{"rendered":"<h3>1\u3001\u4ec0\u4e48\u662f\u89c6\u56fe<\/h3>\n<ul>\n<li>\u89c6\u56fe\u662f\u8868\u865a\u62df\u8868\uff0c\u901a\u8fc7sql\u8bed\u53e5\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\uff0c\u89c6\u56fe\u662f\u539f\u59cb\u6570\u636e\u7684\u4e00\u79cd\u53d8\u6362<\/li>\n<li>\u5b9a\u4e49\uff1acreate view xxx (a, b, c, d) as select h, i, j, k from xxxx xxxxx\uff1b<\/li>\n<li>\u5220\u9664\uff1adrop view xxxx\uff1b<\/li>\n<\/ul>\n<pre><code class=\"language-sql line-numbers\">mysql&gt; select * from user;\n+----+-----------+-----+----------------------------------+-----------------+---------+---------+-----+---------------------+\n| id | user_name | sex | password                         | email           | address | fee     | age | create_at           |\n+----+-----------+-----+----------------------------------+-----------------+---------+---------+-----+---------------------+\n|  1 | sian      | \u7537  | e10adc3949ba59abbe56e057f20f883e | yusian@163.com  | NULL    | 1200.00 |  32 | 2019-04-23 15:57:29 |\n|  2 | \u4f59\u897f\u5b89    | \u7537  | c4ca4238a0b923820dcc509a6f75849b | yusian@163.com  | NULL    |    1.00 |  33 | 2019-04-21 17:12:55 |\n|  3 | Jack      | \u7537  | c81e728d9d4c2f636f067f89cc14862c | jack@yusian.com | NULL    |    0.00 |  22 | 2019-04-21 20:11:59 |\n|  4 | Rose      | \u5973  | eccbc87e4b5ce2fe28308fd9f2a7baf3 | rose@yusian.com | NULL    |    0.00 |  18 | 2019-04-22 10:46:41 |\n|  5 | Sim       | \u5973  | a87ff679a2f3e71d9181a67b7542122c | sim@yusian.com  | NULL    |    0.00 |  28 | 2019-04-22 10:46:41 |\n|  6 | Tony      | \u7537  | c4ca4238a0b923820dcc509a6f75849b | tony@yusian.com | NULL    |    0.00 |  22 | 2019-04-21 20:41:26 |\n+----+-----------+-----+----------------------------------+-----------------+---------+---------+-----+---------------------+\n6 rows in set (0.00 sec)\n\n\nmysql&gt; create view v_user(id, user, pass, email) as select id, user_name, password, email from user where id &lt; 5;\nQuery OK, 0 rows affected (0.00 sec)\n\n\nmysql&gt; select * from v_user;\n+----+-----------+----------------------------------+-----------------+\n| id | user      | pass                             | email           |\n+----+-----------+----------------------------------+-----------------+\n|  1 | sian      | e10adc3949ba59abbe56e057f20f883e | yusian@163.com  |\n|  2 | \u4f59\u897f\u5b89    | c4ca4238a0b923820dcc509a6f75849b | yusian@163.com  |\n|  3 | Jack      | c81e728d9d4c2f636f067f89cc14862c | jack@yusian.com |\n|  4 | Rose      | eccbc87e4b5ce2fe28308fd9f2a7baf3 | rose@yusian.com |\n+----+-----------+----------------------------------+-----------------+\n4 rows in set (0.00 sec)\n\n\nmysql&gt; select id, user, pass from v_user;\n+----+-----------+----------------------------------+\n| id | user      | pass                             |\n+----+-----------+----------------------------------+\n|  1 | sian      | e10adc3949ba59abbe56e057f20f883e |\n|  2 | \u4f59\u897f\u5b89    | c4ca4238a0b923820dcc509a6f75849b |\n|  3 | Jack      | c81e728d9d4c2f636f067f89cc14862c |\n|  4 | Rose      | eccbc87e4b5ce2fe28308fd9f2a7baf3 |\n+----+-----------+----------------------------------+\n4 rows in set (0.00 sec)\n\nmysql&gt; show create view v_user\\G\n*************************** 1. row ***************************\n                View: v_user\n         Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_user` AS select `user`.`id` AS `id`,`user`.`user_name` AS `user`,`user`.`password` AS `pass`,`user`.`email` AS `email` from `user` where (`user`.`id` &lt; 5)\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n1 row in set (0.00 sec)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u4ec0\u4e48\u662f\u89c6\u56fe \u89c6\u56fe\u662f\u8868\u865a\u62df\u8868\uff0c\u901a\u8fc7sql\u8bed\u53e5\u7ec4\u5408\u67e5\u8be2\u7684\u7ed3\u679c\uff0c\u89c6\u56fe\u662f\u539f\u59cb\u6570\u636e\u7684\u4e00\u79cd\u53d8\u6362 \u5b9a\u4e49\uff1acreate view xxx (a, b, c, d) as select h, i, j, k from xxxx xxxxx\uff1b \u5220\u9664\uff1adrop view xxxx\uff1b mysql&gt; select * from user; +&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+ | id | user_name | sex | password | email | address | fee | age | create_at | +&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+ | 1 | sian | \u7537 | e10adc3949ba59abbe56e057f20f883e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[282],"tags":[327,22,330,331],"class_list":["post-1905","post","type-post","status-publish","format-standard","hentry","category-database","tag-database","tag-mysql","tag-view","tag-331"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=1905"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1905\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=1905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=1905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=1905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}