当前位置:Gxlcms > 数据库问题 > MySQL内置help解析(SQL语句说明书)

MySQL内置help解析(SQL语句说明书)

时间:2021-07-01 10:21:17 帮助过:30人阅读

  1. root@db02 scripts]# mysql -uroot -S /data/3306/mysql.sock 
  2. Welcome to the MySQL monitor.  Commands end with ; or \g.
  3. Your MySQL connection id is 1
  4. Server version: 5.6.36 Source distribution
  5. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  6. Oracle is a registered trademark of Oracle Corporation and/or its
  7. affiliates. Other names may be trademarks of their respective
  8. owners.
  9. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
  10. mysql> ? contents  ##我们不知道怎么用,就问系统,你都有什么内容,下面就是它反馈给你的内容
  11. Account Management      ##账户管理
  12. Administration
  13. ###管理
  14. Compound Statements     ##复合语句
  15. Data Definition 
  16. ##数据定义
  17. Data Manipulation
  18. ##数据操作
  19. Data Types
  20.         ##数据类型
  21. Functions
  22. ##功能
  23. Functions and Modifiers for Use with GROUP BY  ##与组一起使用的函数和修饰符
  24. Geographic Features     ##地理特征
  25. Help Metadata 
  26. ##帮助元数据
  27. Language Structure 
  28. ##语言结构
  29. Plugins 
  30. ##插件
  31. Procedures 
  32. ##程序
  33. Storage Engines 
  34. ##存储引擎
  35. Table Maintenance       ##表维护
  36. Transactions  
  37. ##交易
  38. User-Defined Functions  ##用户定义的函数
  39. Utility  
  40. ##效用

2,我们按照它给的说明书,进行下面的询问

  1)例如:我们想新建1个数据库,怎么找到语法呢?

  1. mysql> ?  Data Definition  #查看了上面的说明书,应该在数据如何定义这里面,所以?问号它;
  2. You asked for help about help category: "Data Definition"
  3. For more information, type ‘help <item>‘, where <item> is one of the following
  4. topics:
  5.    CREATE DATABASE
  6.    CREATE EVENT
  7.    CREATE FUNCTION
  8.    CREATE INDEX
  9.    CREATE LOGFILE GROUP
  10.    CREATE PROCEDURE
  11.    CREATE SERVER
  12.    CREATE TABLE
  13.    CREATE TABLESPACE
  14.    CREATE TRIGGER
  15.    .....若干省略选项

2)通过上面 就找到了 CREATE DATABASE 选项,但我还是不会建立数据库啊,那继续问吧

  1. mysql> ? CREATE DATABASE
  2. Name: ‘CREATE DATABASE‘
  3. Description:
  4. Syntax:
  5. CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name  #这次就找到新建数据库的语法了,直接创建即可
  6.     [create_specification] ...    ##需要注意{}大括号多选1,[]可选可忽略,其它必选
  7. create_specification:
  8.     [DEFAULT] CHARACTER SET [=] charset_name
  9.   | [DEFAULT] COLLATE [=] collation_name
  10. CREATE DATABASE creates a database with the given name. To use this
  11. statement, you need the CREATE privilege for the database. CREATE
  12. SCHEMA is a synonym for CREATE DATABASE.
  13. URL: http://dev.mysql.com/doc/refman/5.6/en/create-database.html

3)下面就是根据系统提示的语法,新建一个qiuyuetao的数据库

  1. mysql> create database qiuyuetao;
  2. Query OK, 1 row affected (0.05 sec)
  3. mysql> show databases;
  4. +--------------------+
  5. | Database           |
  6. +--------------------+
  7. | information_schema |
  8. | mysql              |
  9. | performance_schema |
  10. | qiuyuetao          |
  11. | test               |
  12. +--------------------+
  13. 5 rows in set (0.07 sec)

3,SQL语句分为3类

    1)DDL :数据定义的语言,可?Data Definition去查询

  1.  create、alter、drop,管理基础数据:例如 库,表

    2)DCL:Data control Language-数据控制语言

  1.  grant、revoke、commit,rollback,用户授权,权限回收,数据提交回滚

   3)DML:Date Manipulation Language-数据操作语言

  1.   select、update、delete、insert,对表与记录 做操作

希望通过上面的内容,对您有所帮助,如有任何问题,可随时沟通,谢谢。




本文出自 “逗哥笔记” 博客,请务必保留此出处http://qiuyt.blog.51cto.com/1229789/1923286

MySQL内置help解析(SQL语句说明书)

标签:mysql   sql说明书   help帮助   

人气教程排行