MariaDB [(none)]> help contents You asked for help about help category: "Contents" For more information, type 'help <item>', where <item> is one of the following categories: Account Management # 账户管理语句 Administration # 管理员 Compound Statements Data Definition # 数据定义语句 Data Manipulation # 数据操作语句 Data Types # 数据类型 Functions # 函数 Functions and Modifiers for Use with GROUP BY Geographic Features Help Metadata Language Structure Plugins Procedures Table Maintenance Transactions User-Defined Functions Utility
要查看某一类命令或者某单一命令使用,均可使用help KEYWORD查看,例如:
MariaDB [(none)]> help Data Definition;
You asked for help about help category: "Data Definition"
For more information, type 'help <item>', where <item> is one of the following
topics:
ALTER DATABASE
ALTER EVENT
ALTER FUNCTION
...
RENAME TABLE
TRUNCATE TABLE
MariaDB [(none)]> help create table; Name: 'CREATE TABLE' Description: Syntax: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [table_options] [partition_options] Or: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [partition_options] select_statement Or: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name { LIKE old_tbl_name | (LIKE old_tbl_name) } ... 数据类型
自动增长类型 AUTO_INCREMENT 字符型: char/binary varchar/varbinary text/ngtext/blob/ediumblob/longblob set/enum 数值型 int/tinyint/smallint/mediumint/bigint decimal float/double 日期型 date/time/datetime/timestamp/year(2,4)
常见数据库管理语句 选择操作的数据库USE db_name
创建CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name; [DEFAULT] CHARACTER SET [=] charset_name # 设置字符集 [DEFAULT] COLLATE [=] collation_name # 设置排序方式 SHOW CHARACTER SET # 查看支持的所有的字符集 SHOW COLLATION # 查看支持的所有排序方式
修改ALTER {DATABASE | SCHEMA} [db_name]
删除DROP {DATABASE | SCHEMA} [IF EXISTS] db_name
查看SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr]
表管理 创建CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) # 字段定义 [table_options] # 数据表的基本设置 [partition_options] # 分割选项
修改ALTER [ONLINE | OFFLINE] [IGNORE] TABLE tbl_name [alter_specification [, alter_specification] ...] [partition_options]
删除DROP [TEMPORARY] TABLE [IF EXISTS] tbl_name [, tbl_name] ... [RESTRICT | CASCADE]
DML数据操作语言 查看