INSERT INTO <Table-name>(<Column-name>[, ...]) VALUES (<값>[, ...]);
SELECT <Column-name>[, ...] FROM <Table-name> WHERE <조건절>;
UPDATE <Table-name> SET <Column-name>=<값>[, ...] WHERE <조건절>;
DELETE FROM <Table-name> WHERE <조건절>;
SHOW DATABASES;
USE <Database-name>;
SHOW [FULL] TABLES [{FROM | IN} <Database-name>] [LIKE '<pattern>' | WHERE <expression>];
DESCRIBE <Table-name> [<Column-name> | <Wild>]; 또는 SHOW CREATE TABLE <Table-name>;
SELECT * FROM <Table-name>;
USE <Database name>;
SELECT Host FROM mysql.user WHERE user='<Username>';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON <Database name>.* TO <Username>@localhost identified by '<Password>';
GRANT ALL ON <Database name>.* TO <username>;
INSERT INTO mysql.user (host,user,password) VALUES ('%','<Username>',password('<Password>')); GRANT ALL PRIVILEGES ON *.* TO '<Username>'@'%'; FLUSH PRIVILEGES; // 기타: insert into db (host, db, user, select_priv, insert_priv, update_priv, delete_priv, create_priv, drop_priv, grant_priv, references_priv, index_priv, alter_priv) values ('%','{DataBase Name}','{User ID}', 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y' );
INSERT INTO mysql.user (host,user,password) VALUES ('111.222.%','<Username>',password('<Password>')); GRANT ALL PRIVILEGES ON *.* TO '<Username>'@'111.222.%'; FLUSH PRIVILEGES;
CREATE DATABASE [IF NOT EXIST] <Database name>;
DROP DATABASE [IF EXISTS] <Database name>;
USE <Database name>;
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] <Table name> (<정의>) [<OPTION>];
DROP [TEMPORARY] TABLE [IF EXISTS] <Table name> [,<Table name> ...] [RESTRICT | CASCADE];
SELECT <Field name>[,<...>] FROM <Table name>; SELECT * FROM <Table name>;
SELECT <Field name>[,<...>] FROM <Table name> ORDER BY <Field name>[,<...>]; SELECT <Field name>[,<...>] FROM <Table name> ORDER BY <Field name>[,<...>] ASC; SELECT <Field name>[,<...>] FROM <Table name> ORDER BY <Field name>[,<...>] ASCENDING;
SELECT <Field name>[,<...>] FROM <Table name> ORDER BY <Field name>[,<...>] DESC; SELECT <Field name>[,<...>] FROM <Table name> ORDER BY <Field name>[,<...>] DESCENDING;
SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName>=<Value>; SELECT <Field name>[,<...>] FROM <Table name> WHERE NOT <FieldName>=<Value>; SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName>=<Value> [AND <FieldName>=<Value>]; SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName>=<Value> [OR <FieldName>=<Value>]; SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName> IN ('<Value>'[,<...>]); SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName> BETWEEN <Value> AND <Value>; SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName> IS NULL; SELECT <Field name>[,<...>] FROM <Table name> WHERE <FieldName> LIKE '<WildValue>';