【MySQL】使用概要

2390 ワード

1、増加
INSERT INTO "tableName( 1, 2,...)" VALUES( 1, 2,...)
/* 1,         。
   2,     ,                   。
*/

2、削除
DELETE FROM "tableName" WHERE "condition1" AND "condition2" ...
/*                where     。 */

3、変更
UPDATE "tableName" SET "key = value" WHERE "condition1" AND "condition2" ... 
/*   where     ,             。*/

4、調べます
SELECT "fields" FROM "tableName" WHERE "condition" 
/*     ,                。where  (fields)    。 */

SELECT "fields" FROM "table1, table2,..." WHERE "condition1" AND "condition2" ... 
/*     ,                    。*/

5、データベース
CREATE DATABASE "databaseName" /*       */

DROP DATABASE "databaseName" /*       */

6,データテーブル
CREATE TABLE table_name (columnName columnType) /*      ,column_type        */

DROP TABLE "tableName" /*       */

ALTER TABLE "tableName" RENAME TO "newTableName"  /*      */

7,ALTER
ALTER TABLE "tableName" DROP "columnName" /*          */

ALTER TABLE "tableName" ADD "columnName columnType" FIRST/[AFTER "columnName"] 
/*                        */

ALTER TABLE "tableName" MODIFY "columnName" "newColumnType" /*               */

ALTER TABLE "tableName" CHANGE "columnName" "columnName newColumnType" 
/*                       ,           */

ALTER TABLE "tableName" RENAME TO "newTableName"  /*      */

8、権限
GRANT "power" ON "databaseName" TO "user" /*    user     databaseName     power*/
REVOKE "power" ON "databaseName" FROM "user" /*     user    databaseName    power */
FLUSH PRIVILEGES /*     MySQL               */

9、その他
GROUP BY "columnName" /*                */
ORDER BY "columnName"  ASC/DESC /*               ,  ASC,  DESC */
SUM("columnName") /*           */
COUNT("columnName") /*           */
AVG("columnName") /*               */
.......................    

訂正を歓迎します.続きは勉强の中で补充します.ありがとうございます.