{"id":5921,"date":"2024-11-14T12:29:00","date_gmt":"2024-11-14T04:29:00","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5921\/"},"modified":"2024-11-14T12:29:00","modified_gmt":"2024-11-14T04:29:00","slug":"sql%e6%80%8e%e4%b9%88%e6%9f%a5%e8%af%a2%e6%95%b0%e6%8d%ae%e5%ba%93%e4%b8%ad%e6%89%80%e6%9c%89%e7%9a%84%e8%a1%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5921\/","title":{"rendered":"sql\u600e\u4e48\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u8868"},"content":{"rendered":"<blockquote><p>\n  \u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u547d\u4ee4\u56e0 dbms \u800c\u5f02\uff0c\u4ee5\u4e0b\u662f\u4e09\u79cd\u5e38\u89c1 dbms \u7684\u547d\u4ee4\uff1amysql\uff1ashow tables;postgresql\uff1aselect * from pg_catalog.pg_tables;sqlite\uff1aselect name from sqlite_master where type = &#8216;table&#8217;;\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/03\/2024060322271439273.jpg\" class=\"aligncenter\" title=\"sql\u600e\u4e48\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u8868\u63d2\u56fe\" alt=\"sql\u600e\u4e48\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u8868\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u8868<\/strong><\/p>\n<p>\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u547d\u4ee4\u56e0\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08DBMS\uff09\u800c\u5f02\u3002\u4ee5\u4e0b\u662f\u4e09\u79cd\u6700\u5e38\u7528\u7684 DBMS \u7684\u67e5\u8be2\u547d\u4ee4\uff1a<\/p>\n<p><strong>MySQL<\/strong><\/p>\n<pre>SHOW TABLES;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>PostgreSQL<\/strong><\/p>\n<pre>SELECT * FROM pg_catalog.pg_tables;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>SQLite<\/strong><\/p>\n<pre>SELECT name FROM sqlite_master WHERE type = 'table';<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e9b\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u540d\u79f0\u7684\u7ed3\u679c\u96c6\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u5176\u4ed6\u5b50\u53e5\u6765\u8fc7\u6ee4\u7ed3\u679c\uff0c\u4f8b\u5982\uff1a<\/p>\n<p><strong>MySQL<\/strong><\/p>\n<pre>SHOW TABLES LIKE '%user%';<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>PostgreSQL<\/strong><\/p>\n<pre>SELECT * FROM pg_catalog.pg_tables WHERE tableowner = 'someuser';<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>SQLite<\/strong><\/p>\n<pre>SELECT name FROM sqlite_master WHERE type = 'table' AND tbl_name LIKE '%user%';<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u4e9b\u793a\u4f8b\u67e5\u8be2\u5c06\u8fd4\u56de\u6240\u6709\u540d\u79f0\u5305\u542b\u5b57\u7b26\u4e32\u201cuser\u201d\u7684\u8868\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fsql\u600e\u4e48\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u8868\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u547d\u4ee4\u56e0 dbms \u800c\u5f02\uff0c\u4ee5\u4e0b\u662f\u4e09\u79cd\u5e38\u89c1 dbms \u7684\u547d\u4ee4\uff1amysql\uff1ashow tables;postgresql\uff1aselect * from pg_catalog.pg_tables;sqlite\uff1aselect name from sqlite_master where type = &#8216;table&#8217;; \u5982\u4f55\u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u7684\u8868 \u67e5\u8be2\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u7684\u547d\u4ee4\u56e0\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08DBMS\uff09\u800c\u5f02\u3002\u4ee5\u4e0b\u662f\u4e09\u79cd\u6700\u5e38\u7528\u7684 DBMS \u7684\u67e5\u8be2\u547d\u4ee4\uff1a MySQL SHOW TABLES; \u767b\u5f55\u540e\u590d\u5236 PostgreSQL SELECT * FROM pg_catalog.pg_tables; \u767b\u5f55\u540e\u590d\u5236 SQLite SELECT name FROM sqlite_master WHERE type = &#8216;table&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u4e9b\u547d\u4ee4\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\u540d\u79f0\u7684\u7ed3\u679c\u96c6\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u5176\u4ed6\u5b50\u53e5\u6765\u8fc7\u6ee4\u7ed3\u679c\uff0c\u4f8b\u5982\uff1a MySQL SHOW TABLES LIKE &#8216;%user%&#8217;; \u767b\u5f55\u540e\u590d\u5236 PostgreSQL SELECT * FROM pg_catalog.pg_tables WHERE tableowner = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5921","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5921"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5921\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}