时间:2021-07-01 10:21:17 帮助过:30人阅读
- root@db02 scripts]# mysql -uroot -S /data/3306/mysql.sock
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.6.36 Source distribution
- Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- Oracle is a registered trademark of Oracle Corporation and/or its
- affiliates. Other names may be trademarks of their respective
- owners.
- Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
- mysql> ? contents ##我们不知道怎么用,就问系统,你都有什么内容,下面就是它反馈给你的内容
- 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
- ##程序
- Storage Engines
- ##存储引擎
- Table Maintenance ##表维护
- Transactions
- ##交易
- User-Defined Functions ##用户定义的函数
- Utility
- ##效用
2,我们按照它给的说明书,进行下面的询问
1)例如:我们想新建1个数据库,怎么找到语法呢?
- mysql> ? 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:
- CREATE DATABASE
- CREATE EVENT
- CREATE FUNCTION
- CREATE INDEX
- CREATE LOGFILE GROUP
- CREATE PROCEDURE
- CREATE SERVER
- CREATE TABLE
- CREATE TABLESPACE
- CREATE TRIGGER
- .....若干省略选项
2)通过上面 就找到了 CREATE DATABASE 选项,但我还是不会建立数据库啊,那继续问吧
- mysql> ? CREATE DATABASE
- Name: ‘CREATE DATABASE‘
- Description:
- Syntax:
- CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name #这次就找到新建数据库的语法了,直接创建即可
- [create_specification] ... ##需要注意{}大括号多选1,[]可选可忽略,其它必选
- create_specification:
- [DEFAULT] CHARACTER SET [=] charset_name
- | [DEFAULT] COLLATE [=] collation_name
- CREATE DATABASE creates a database with the given name. To use this
- statement, you need the CREATE privilege for the database. CREATE
- SCHEMA is a synonym for CREATE DATABASE.
- URL: http://dev.mysql.com/doc/refman/5.6/en/create-database.html
3)下面就是根据系统提示的语法,新建一个qiuyuetao的数据库
- mysql> create database qiuyuetao;
- Query OK, 1 row affected (0.05 sec)
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- | qiuyuetao |
- | test |
- +--------------------+
- 5 rows in set (0.07 sec)
3,SQL语句分为3类
1)DDL :数据定义的语言,可?Data Definition去查询
- create、alter、drop,管理基础数据:例如 库,表
2)DCL:Data control Language-数据控制语言
- grant、revoke、commit,rollback,用户授权,权限回收,数据提交回滚
3)DML:Date Manipulation Language-数据操作语言
- select、update、delete、insert,对表与记录 做操作
希望通过上面的内容,对您有所帮助,如有任何问题,可随时沟通,谢谢。
本文出自 “逗哥笔记” 博客,请务必保留此出处http://qiuyt.blog.51cto.com/1229789/1923286
MySQL内置help解析(SQL语句说明书)
标签:mysql sql说明书 help帮助