DDL—数据定义语言(Create,Alter,Drop,DECLARE)
DML—数据操纵语言(Select,Delete,Update,Insert)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
库
CREATE
CREATE DATABASE db_name;
DROP
DROP DATABASE db_name;
SHOW
SHOW DATABASES;
SHOW CREATE DATABASE db_name;
USE
USE db_name;
表
CREATE
CREATE TABLE tb_name(.......);
SHOW
SHOW TABLES;
DESC
DESC db_name;
RENAME
RENAME TABLE tb_name TO new_tb_name;
DROP
DROP TABLE tb_name;
ALTER
修改字段
字段(列)
ALTER MODIFY
ALTER TABLE tb_name MODIFY column ......
ALTER CHANGE
ALTER TABLE tb_name CHANGE column_name new_name
ALTER DROP
ALTER TABLE tb_name DROP column
ALTER ADD
ALTER TABLE tb_name ADD column ......
记录
SELECT FROM
SELECT * FROM tb_name WHERE,,,;
INSERT INTO
INSERT INTO table_name ( field1, field2,...fieldN )
VALUES
( value1, value2,...valueN );
UPDATE SET
UPDATE table_name SET field1=new-value1, field2=new-value2
WHERE Clause
DELETE FROM
DELETE FROM table_name [WHERE Clause]
GRANT
GRANT 权限1,权限2...
ON 对象类型 对象名
TO 用户1,用户2...
(WITH GRANT OPTION) ;
REVOKE
REVOKE 权限1,权限2...
ON 对象类型 对象名
FROM 用户1,用户2...;
网友评论