\u4ee5\u540c\u6837\u7684\u65b9\u5f0f\u68c0\u67e5\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u60a8\u8fd8\u53ef\u4ee5\u67e5\u770b\u6570\u636e\u5e93\u5305\u542b\u7684\u8868\u7684\u6982\u8ff0\u3002<\/p>\n
\r\n SHOW tables; \r\n<\/pre>\n\u7531\u4e8e\u8fd9\u662f\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u5e93\uff0cMySQL\u6ca1\u6709\u4efb\u4f55\u663e\u793a\uff0c\u4f60\u4f1a\u5f97\u5230\u4e00\u4e2a\u6d88\u606f\uff0c\u8bf4\u201c\u7a7a\u96c6\u201d<\/p>\n
\u5982\u4f55\u521b\u5efaMySQL\u8868<\/p>\n
\u8ba9\u6211\u4eec\u60f3\u8c61\u4e00\u4e0b\uff0c\u6211\u4eec\u6b63\u5728\u8ba1\u5212\u4e00\u8d77\u805a\u4f1a\u7684\u670b\u53cb\u3002 \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528MySQL\u8ddf\u8e2a\u4e8b\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n
\u8ba9\u6211\u4eec\u521b\u5efa\u4e00\u4e2a\u65b0\u7684MySQL\u8868\uff1a<\/p>\n
\r\nCREATE TABLE potluck (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, \r\nname VARCHAR(20),\r\nfood VARCHAR(30),\r\nconfirmed CHAR(1), \r\nsignup_date DATE);\r\n<\/pre>\n\u8fd9\u4e2a\u547d\u4ee4\u5b8c\u6210\u4e86\u4e00\u4e9b\u4e8b\u60c5\uff1a<\/p>\n
\u5b83\u5df2\u7ecf\u5728\u76ee\u5f55\uff0c\u4e8b\u4ef6\u4e2d\u521b\u5efa\u4e86\u4e00\u4e2a\u540d\u4e3apotluck\u7684\u8868\u3002<\/p>\n
\u6211\u4eec\u5728\u8868id\uff0c\u540d\u79f0\uff0c\u98df\u54c1\uff0c\u786e\u8ba4\u548c\u6ce8\u518c\u65e5\u671f\u4e2d\u8bbe\u7f6e\u4e865\u5217\u3002<\/p>\n
\u201cid\u201d\u5217\u5177\u6709\u81ea\u52a8\u4e3a\u6bcf\u884c\u7f16\u53f7\u7684\u547d\u4ee4\uff08INT NOT NULL PRIMARY KEY AUTO_INCREMENT\uff09\u3002<\/p>\n
\u201c\u540d\u79f0\u201d\u5217\u5df2\u88abVARCHAR\u547d\u4ee4\u9650\u5236\u4e3a\u4e0d\u8d85\u8fc720\u4e2a\u5b57\u7b26\u3002<\/p>\n
\u201c\u98df\u7269\u201d\u680f\u6307\u5b9a\u6bcf\u4e2a\u4eba\u5c06\u5e26\u6765\u7684\u98df\u7269\u3002 VARCHAR\u5c06\u6587\u672c\u9650\u5236\u4e3a30\u4e2a\u5b57\u7b26\u4ee5\u4e0b\u3002<\/p>\n
\u201c\u786e\u8ba4\u201d\u5217\u8bb0\u5f55\u8be5\u4eba\u662f\u5426\u5df2\u7528\u4e00\u4e2a\u5b57\u6bcdY\u6216N\u56de\u590d\u3002<\/p>\n
\u201c\u65e5\u671f\u201d\u5217\u5c06\u663e\u793a\u4ed6\u4eec\u6ce8\u518c\u6d3b\u52a8\u7684\u65f6\u95f4\u3002 MySQL\u8981\u6c42\u65e5\u671f\u5199\u4e3ayyyy-mm-dd<\/p>\n
\u8ba9\u6211\u4eec\u4f7f\u7528\u201cSHOW TABLES;\u201d\u6765\u67e5\u770b\u8868\u5728\u6570\u636e\u5e93\u4e2d\u7684\u663e\u793a\u65b9\u5f0f\u3002 \u547d\u4ee4\uff1a<\/p>\n
\r\n mysql> SHOW TABLES;\r\n+------------------+\r\n| Tables_in_events |\r\n+------------------+\r\n| potluck |\r\n+------------------+\r\n1 row in set (0.01 sec)\r\n<\/pre>\n\u6211\u4eec\u53ef\u4ee5\u7528\u8fd9\u4e2a\u547d\u4ee4\u63d0\u9192\u81ea\u5df1\u5173\u4e8e\u8868\u7684\u7ec4\u7ec7\uff1a<\/p>\n
\r\n DESCRIBE potluck;\r\n<\/pre>\n\u8bf7\u8bb0\u4f4f\uff0c\u867d\u7136MySQL\u547d\u4ee4\u884c\u4e0d\u6ce8\u610f\u60c5\u51b5\uff0c\u8868\u548c\u6570\u636e\u5e93\u540d\u79f0\u533a\u5206\u5927\u5c0f\u5199\uff1apotluck\u4e0d\u540c\u4e8ePOTLUCK\u6216Potluck\u3002<\/p>\n
\r\n mysql>DESCRIBE potluck;\r\n+-------------+-------------+------+-----+---------+----------------+\r\n| Field | Type | Null | Key | Default | Extra |\r\n+-------------+-------------+------+-----+---------+----------------+\r\n| id | int(11) | NO | PRI | NULL | auto_increment |\r\n| name | varchar(20) | YES | | NULL | |\r\n| food | varchar(30) | YES | | NULL | |\r\n| confirmed | char(1) | YES | | NULL | |\r\n| signup_date | date | YES | | NULL | |\r\n+-------------+-------------+------+-----+---------+----------------+\r\n5 rows in set (0.01 sec)\r\n<\/pre>\n\u5982\u4f55\u5411MySQL\u8868\u6dfb\u52a0\u4fe1\u606f<\/strong><\/span><\/div>\n\u6211\u4eec\u6709\u6211\u4eec\u515a\u7684\u5de5\u4f5c\u8868\u3002 \u73b0\u5728\u662f\u65f6\u5019\u5f00\u59cb\u586b\u5199\u7ec6\u8282\u4e86\u3002<\/p>\n
\u4f7f\u7528\u6b64\u683c\u5f0f\u5728\u6bcf\u884c\u4e2d\u63d2\u5165\u4fe1\u606f\uff1a<\/p>\n
\r\nINSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, \"John\", \"Casserole\",\"Y\", '2012-04-11');\u4e00\u65e6\u4f60\u8f93\u5165\uff0c\u4f60\u4f1a\u770b\u5230\u7684\u8bdd\uff1a\r\n Query OK, 1 row affected (0.00 sec)\u8ba9\u6211\u4eec\u5411\u6211\u4eec\u7684\u7fa4\u7ec4\u6dfb\u52a0\u66f4\u591a\u4eba\uff1a\r\nINSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, \"Sandy\", \"Key Lime Tarts\",\"N\", '2012-04-14');\r\nINSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, \"Tom\", \"BBQ\",\"Y\", '2012-04-18');\r\nINSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, \"Tina\", \"Salad\",\"Y\", '2012-04-10'); \r\n<\/pre>\n\u6211\u4eec\u53ef\u4ee5\u770b\u770b\u6211\u4eec\u7684\u8868\uff1a<\/p>\n
\r\nmysql> SELECT * FROM potluck;\r\n+----+-------+----------------+-----------+-------------+\r\n| id | name | food | confirmed | signup_date |\r\n+----+-------+----------------+-----------+-------------+\r\n| 1 | John | Casserole | Y | 2012-04-11 |\r\n| 2 | Sandy | Key Lime Tarts | N | 2012-04-14 |\r\n| 3 | Tom | BBQ | Y | 2012-04-18 |\r\n| 4 | Tina | Salad | Y | 2012-04-10 |\r\n+----+-------+----------------+-----------+-------------+\r\n4 rows in set (0.00 sec)\r\n<\/pre>\n\u5982\u4f55\u66f4\u65b0\u8868\u4e2d\u7684\u4fe1\u606f<\/strong><\/span><\/div>\n\u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u5f00\u59cb\u4e86\u6211\u4eec\u7684potluck\u5217\u8868\uff0c\u6211\u4eec\u53ef\u4ee5\u89e3\u51b3\u4efb\u4f55\u53ef\u80fd\u7684\u66f4\u6539\u3002 \u4f8b\u5982\uff1aSandy\u5df2\u7ecf\u786e\u8ba4\u5979\u6b63\u5728\u53c2\u52a0\uff0c\u56e0\u6b64\u6211\u4eec\u5c06\u5728\u8868\u4e2d\u66f4\u65b0\u3002<\/p>\n
\r\nUPDATE `potluck` \r\nSET \r\n`confirmed` = 'Y' \r\nWHERE `potluck`.`name` ='Sandy';\r\n<\/pre>\n\u60a8\u4e5f\u53ef\u4ee5\u4f7f\u7528\u6b64\u547d\u4ee4\u5c06\u4fe1\u606f\u6dfb\u52a0\u5230\u7279\u5b9a\u5355\u5143\u683c\uff0c\u5373\u4f7f\u5b83\u4eec\u662f\u7a7a\u7684\u3002<\/p>\n
\u5982\u4f55\u6dfb\u52a0\u548c\u5220\u9664\u5217<\/strong><\/span><\/div>\n\u6211\u4eec\u6b63\u5728\u521b\u5efa\u4e00\u4e2a\u65b9\u4fbf\u7684\u56fe\u8868\uff0c\u4f46\u5b83\u7f3a\u5c11\u4e00\u4e9b\u91cd\u8981\u7684\u4fe1\u606f\uff1a\u6211\u4eec\u7684\u53c2\u4e0e\u8005\u7684\u7535\u5b50\u90ae\u4ef6\u3002<\/p>\n
\u6211\u4eec\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u6dfb\u52a0\uff1a<\/p>\n
\r\n ALTER TABLE potluck ADD email VARCHAR(40);\r\n<\/pre>\n\u6b64\u547d\u4ee4\u5c06\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5c06\u540d\u4e3a\u201cemail\u201d\u7684\u65b0\u5217\u7f6e\u4e8e\u8868\u7684\u672b\u5c3e\uff0cVARCHAR\u547d\u4ee4\u5c06\u5176\u9650\u5236\u4e3a40\u4e2a\u5b57\u7b26\u3002<\/p>\n
\u4f46\u662f\uff0c\u5982\u679c\u60a8\u9700\u8981\u5c06\u8be5\u5217\u653e\u7f6e\u5728\u8868\u4e2d\u7684\u7279\u5b9a\u4f4d\u7f6e\uff0c\u6211\u4eec\u53ef\u4ee5\u5411\u547d\u4ee4\u4e2d\u518d\u6dfb\u52a0\u4e00\u4e2a\u77ed\u8bed\u3002<\/p>\n
\r\n ALTER TABLE potluck ADD email VARCHAR(40) AFTER name; \r\n<\/pre>\n\u73b0\u5728\uff0c\u65b0\u7684\u201c\u7535\u5b50\u90ae\u4ef6\u201d\u5217\u4f4d\u4e8e\u5217\u201c\u540d\u79f0\u201d\u4e4b\u540e\u3002<\/p>\n
\u6b63\u5982\u60a8\u53ef\u4ee5\u6dfb\u52a0\u5217\u4e00\u6837\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5220\u9664\u4e00\u5217\uff1a<\/p>\n
\r\nALTER TABLE potluck DROP email;\r\n<\/pre>\n\u6211\u60f3\u6211\u4eec\u6c38\u8fdc\u4e0d\u4f1a\u77e5\u9053\u5982\u4f55\u5230\u8fbe\u91ce\u9910\u4f1a\u3002<\/p>\n
\u5982\u4f55\u5220\u9664\u884c<\/strong><\/span><\/div>\n\u5982\u679c\u9700\u8981\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4ece\u8868\u4e2d\u5220\u9664\u884c\uff1a<\/p>\n
\r\nDELETE from [table \u201c\u201d not found \/]
\n where [column name]=[field text];\r\n<\/pre>\n\u4f8b\u5982\uff0c\u5982\u679c\u6851\u8fea\u7a81\u7136\u610f\u8bc6\u5230\u5979\u5c06\u4e0d\u80fd\u53c2\u52a0\u767e\u4e50\uff0c\u6bd5\u7adf\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u5feb\u6d88\u9664\u5979\u7684\u7ec6\u8282\u3002<\/p>\n
\r\nmysql> DELETE from potluck where name='Sandy';\r\nQuery OK, 1 row affected (0.00 sec)\r\n\r\nmysql> SELECT * FROM potluck;\r\n+----+------+-----------+-----------+-------------+\r\n| id | name | food | confirmed | signup_date |\r\n+----+------+-----------+-----------+-------------+\r\n| 1 | John | Casserole | Y | 2012-04-11 |\r\n| 3 | Tom | BBQ | Y | 2012-04-18 |\r\n| 4 | Tina | Salad | Y | 2012-04-10 |\r\n+----+------+-----------+-----------+-------------+\r\n3 rows in set (0.00 sec)\r\n<\/pre>\n\u8bf7\u6ce8\u610f\uff0c\u4e0e\u6bcf\u4e2a\u4eba\u76f8\u5173\u8054\u7684id\u53f7\u4fdd\u6301\u4e0d\u53d8\u3002<\/p>\n
\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/www.howtoing.com\/a-basic-mysql-tutorial<\/a><\/p>\n\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/ubuntu-centos-mysql.html<\/a>\u7f16\u8f91\uff1a\u5434\u5411\u5e73\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"\u5bfc\u8bfb MySQL\u662f\u4e00\u4e2a\u5f00\u6e90\u6570\u636e\u5e93\u7ba1\u7406\u8f6f\u4ef6\uff0c\u53ef\u5e2e\u52a9\u7528\u6237\u5b58\u50a8\uff0c\u7ec4\u7ec7\u548c\u68c0\u7d22\u6570\u636e\u3002 \u5b83\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u7a0b\u5e8f\uff0c\u5177\u6709\u5f88\u5927\u7684 […]<\/p>\n","protected":false},"author":668,"featured_media":4956,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-107735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/668"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=107735"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107735\/revisions"}],"predecessor-version":[{"id":293728,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/107735\/revisions\/293728"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/4956"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=107735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=107735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=107735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}