将mysql help more_MySQL内置help解析(SQL语句说明书)

MySQL数据库是关系型数据库,它是用SQL语句进行数据存取的,所以熟练运用SQL语句是必须的,那么我们如何掌握呢,其实MySQL 内置的help 已经告诉你,如何运用它,下面我们就来看看

1,登录MySQL,询问系统内置说明书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 ', where  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,对表与记录 做操作

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值