{"id":142569,"date":"2024-10-31T22:53:20","date_gmt":"2024-10-31T14:53:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/142569\/"},"modified":"2024-10-31T22:53:20","modified_gmt":"2024-10-31T14:53:20","slug":"sqlite-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b0%a1%e4%bb%8b%e5%8f%8a%e8%b3%87%e6%ba%90%e4%b8%8b%e8%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/142569\/","title":{"rendered":"SQLite \u6578\u64da\u5eab\u7c21\u4ecb\u53ca\u8cc7\u6e90\u4e0b\u8f09"},"content":{"rendered":"<h1 id=\"sqlite-%e6%95%b8%e6%93%9a%e5%ba%ab%e7%b0%a1%e4%bb%8b%e5%8f%8a%e8%b3%87%e6%ba%90%e4%b8%8b%e8%bc%89-mspfNVcQvw\">SQLite \u6578\u64da\u5eab\u7c21\u4ecb\u53ca\u8cc7\u6e90\u4e0b\u8f09<\/h1>\n<p>SQLite \u662f\u4e00\u7a2e\u8f15\u91cf\u7d1a\u7684\u95dc\u806f\u5f0f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u7a0b\u5e8f\u4e2d\u3002\u5b83\u7684\u8a2d\u8a08\u76ee\u7684\u662f\u70ba\u4e86\u63d0\u4f9b\u4e00\u500b\u7c21\u55ae\u3001\u5feb\u901f\u4e14\u9ad8\u6548\u7684\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\uff0c\u7279\u5225\u9069\u5408\u5d4c\u5165\u5f0f\u7cfb\u7d71\u548c\u5c0f\u578b\u61c9\u7528\u3002\u672c\u6587\u5c07\u4ecb\u7d39 SQLite \u7684\u57fa\u672c\u7279\u6027\u3001\u4f7f\u7528\u5834\u666f\u4ee5\u53ca\u8cc7\u6e90\u4e0b\u8f09\u7684\u76f8\u95dc\u4fe1\u606f\u3002<\/p>\n<h2 id=\"sqlite-%e7%9a%84%e5%9f%ba%e6%9c%ac%e7%89%b9%e6%80%a7-mspfNVcQvw\">SQLite \u7684\u57fa\u672c\u7279\u6027<\/h2>\n<ul>\n<li><strong>\u8f15\u91cf\u7d1a\uff1a<\/strong>SQLite \u7684\u6574\u9ad4\u5927\u5c0f\u975e\u5e38\u5c0f\uff0c\u901a\u5e38\u53ea\u6709\u5e7e\u767e KB\uff0c\u9019\u4f7f\u5f97\u5b83\u975e\u5e38\u9069\u5408\u5d4c\u5165\u5f0f\u61c9\u7528\u3002<\/li>\n<li><strong>\u7121\u9700\u5b89\u88dd\uff1a<\/strong>SQLite \u662f\u4e00\u500b\u81ea\u5305\u542b\u7684\u6578\u64da\u5eab\uff0c\u7121\u9700\u5b89\u88dd\u6216\u914d\u7f6e\uff0c\u4f7f\u7528\u8005\u53ea\u9700\u5c07\u5176\u5eab\u6587\u4ef6\u5305\u542b\u5728\u61c9\u7528\u4e2d\u5373\u53ef\u3002<\/li>\n<li><strong>\u8de8\u5e73\u53f0\uff1a<\/strong>SQLite \u652f\u6301\u591a\u7a2e\u64cd\u4f5c\u7cfb\u7d71\uff0c\u5305\u62ec Windows\u3001Linux\u3001macOS \u548c Android\uff0c\u9019\u4f7f\u5f97\u5b83\u5728\u4e0d\u540c\u74b0\u5883\u4e2d\u7684\u517c\u5bb9\u6027\u975e\u5e38\u597d\u3002<\/li>\n<li><strong>ACID \u517c\u5bb9\uff1a<\/strong>SQLite \u652f\u6301\u539f\u5b50\u6027\u3001\u4e00\u81f4\u6027\u3001\u9694\u96e2\u6027\u548c\u6301\u4e45\u6027\uff08ACID\uff09\uff0c\u78ba\u4fdd\u6578\u64da\u7684\u5b8c\u6574\u6027\u548c\u5b89\u5168\u6027\u3002<\/li>\n<li><strong>\u7c21\u55ae\u7684 SQL \u8a9e\u6cd5\uff1a<\/strong>SQLite \u4f7f\u7528\u6a19\u6e96\u7684 SQL \u8a9e\u6cd5\uff0c\u9019\u4f7f\u5f97\u958b\u767c\u8005\u53ef\u4ee5\u8f15\u9b06\u4e0a\u624b\uff0c\u7121\u9700\u5b78\u7fd2\u65b0\u7684\u67e5\u8a62\u8a9e\u8a00\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e5%a0%b4%e6%99%af-mspfNVcQvw\">\u4f7f\u7528\u5834\u666f<\/h2>\n<p>SQLite \u7684\u7279\u6027\u4f7f\u5176\u9069\u5408\u65bc\u591a\u7a2e\u4f7f\u7528\u5834\u666f\uff0c\u5305\u62ec\u4f46\u4e0d\u9650\u65bc\uff1a<\/p>\n<ul>\n<li><strong>\u79fb\u52d5\u61c9\u7528\uff1a<\/strong>\u8a31\u591a\u79fb\u52d5\u61c9\u7528\u7a0b\u5e8f\u4f7f\u7528 SQLite \u4f5c\u70ba\u672c\u5730\u6578\u64da\u5b58\u5132\u89e3\u6c7a\u65b9\u6848\uff0c\u56e0\u70ba\u5b83\u7684\u8f15\u91cf\u7d1a\u548c\u9ad8\u6548\u6027\u80fd\u3002<\/li>\n<li><strong>\u684c\u9762\u61c9\u7528\uff1a<\/strong>\u8a31\u591a\u684c\u9762\u61c9\u7528\u7a0b\u5e8f\u4e5f\u9078\u64c7\u4f7f\u7528 SQLite \u4f86\u7ba1\u7406\u7528\u6236\u6578\u64da\uff0c\u56e0\u70ba\u5b83\u4e0d\u9700\u8981\u984d\u5916\u7684\u670d\u52d9\u5668\u652f\u6301\u3002<\/li>\n<li><strong>Web \u61c9\u7528\uff1a<\/strong>\u5728\u67d0\u4e9b\u5c0f\u578b Web \u61c9\u7528\u4e2d\uff0cSQLite \u53ef\u4ee5\u4f5c\u70ba\u5f8c\u7aef\u6578\u64da\u5eab\uff0c\u7279\u5225\u662f\u5728\u958b\u767c\u548c\u6e2c\u8a66\u968e\u6bb5\u3002<\/li>\n<li><strong>\u7269\u806f\u7db2\u8a2d\u5099\uff1a<\/strong>\u7531\u65bc\u5176\u5c0f\u5de7\u548c\u9ad8\u6548\uff0cSQLite \u5e38\u88ab\u7528\u65bc\u7269\u806f\u7db2\u8a2d\u5099\u4e2d\uff0c\u4f5c\u70ba\u6578\u64da\u5b58\u5132\u7684\u89e3\u6c7a\u65b9\u6848\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c%e7%a4%ba%e4%be%8b-mspfNVcQvw\">\u57fa\u672c\u64cd\u4f5c\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684 SQLite \u64cd\u4f5c\u793a\u4f8b\uff0c\u5e6b\u52a9\u8b80\u8005\u5feb\u901f\u4e0a\u624b\uff1a<\/p>\n<pre><code>-- \u5275\u5efa\u6578\u64da\u8868\nCREATE TABLE users (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    name TEXT NOT NULL,\n    email TEXT NOT NULL UNIQUE\n);\n\n-- \u63d2\u5165\u6578\u64da\nINSERT INTO users (name, email) VALUES ('\u5f35\u4e09', 'zhangsan@example.com');\n\n-- \u67e5\u8a62\u6578\u64da\nSELECT * FROM users;\n\n-- \u66f4\u65b0\u6578\u64da\nUPDATE users SET email = 'zhangsan_new@example.com' WHERE id = 1;\n\n-- \u522a\u9664\u6578\u64da\nDELETE FROM users WHERE id = 1;\n<\/code><\/pre>\n<h2 id=\"%e8%b3%87%e6%ba%90%e4%b8%8b%e8%bc%89-mspfNVcQvw\">\u8cc7\u6e90\u4e0b\u8f09<\/h2>\n<p>SQLite \u7684\u5b98\u65b9\u7db2\u7ad9\u63d0\u4f9b\u4e86\u8c50\u5bcc\u7684\u8cc7\u6e90\uff0c\u5305\u62ec\u6587\u6a94\u3001\u4e0b\u8f09\u93c8\u63a5\u548c\u793a\u4f8b\u4ee3\u78bc\u3002\u7528\u6236\u53ef\u4ee5\u8a2a\u554f\u4ee5\u4e0b\u93c8\u63a5\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/www.sqlite.org\/download.html\" rel=\"nofollow noopener\" target=\"_blank\">SQLite \u4e0b\u8f09\u9801\u9762<\/a><\/li>\n<li><a href=\"https:\/\/www.sqlite.org\/docs.html\" rel=\"nofollow noopener\" target=\"_blank\">SQLite \u5b98\u65b9\u6587\u6a94<\/a><\/li>\n<li><a href=\"https:\/\/www.sqlite.org\/faq.html\" rel=\"nofollow noopener\" target=\"_blank\">SQLite \u5e38\u898b\u554f\u984c\u89e3\u7b54<\/a><\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-mspfNVcQvw\">\u7e3d\u7d50<\/h2>\n<p>SQLite \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u4e14\u9748\u6d3b\u7684\u6578\u64da\u5eab\u89e3\u6c7a\u65b9\u6848\uff0c\u9069\u5408\u5404\u7a2e\u61c9\u7528\u5834\u666f\u3002\u7121\u8ad6\u662f\u79fb\u52d5\u61c9\u7528\u3001\u684c\u9762\u61c9\u7528\u9084\u662f\u7269\u806f\u7db2\u8a2d\u5099\uff0cSQLite \u90fd\u80fd\u63d0\u4f9b\u9ad8\u6548\u7684\u6578\u64da\u5b58\u5132\u548c\u7ba1\u7406\u529f\u80fd\u3002\u5c0d\u65bc\u9700\u8981\u8f15\u91cf\u7d1a\u6578\u64da\u5eab\u7684\u958b\u767c\u8005\u4f86\u8aaa\uff0cSQLite \u662f\u4e00\u500b\u7406\u60f3\u7684\u9078\u64c7\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4f86\u652f\u6301\u60a8\u7684\u61c9\u7528\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u3002\u66f4\u591a\u4fe1\u606f\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3SQLite\u6578\u64da\u5eab\u7684\u57fa\u672c\u6982\u5ff5\uff0c\u63a2\u7d22\u5176\u7279\u6027\u53ca\u529f\u80fd\uff0c\u4e26\u7372\u53d6\u76f8\u95dc\u8cc7\u6e90\u4e0b\u8f09\uff0c\u52a9\u60a8\u8f15\u9b06\u4e0a\u624b\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-142569","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/142569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=142569"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/142569\/revisions"}],"predecessor-version":[{"id":142570,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/142569\/revisions\/142570"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=142569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=142569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=142569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}