MySQL database is a relational database, it is the use of SQL statements for data access, so skilled use of SQL statements is necessary, then how we grasp, in fact, MySQL built-in Help has told you how to use it, below we will look at
1, log in to MySQL, ask the system built-in instructions
[Email protected] scripts]# mysql -uroot -s /data/3306/mysql.sock welcome to the mysql monitor. commands end with ; or \g.your MySQL connection id is 1Server version: 5.6.36 Source distributioncopyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. oracle is a registered trademark of oracle corporation and/or Itsaffiliates. other names may be trademarks of their respectiveowners . type ' help; ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> ? contents # #我们不知道怎么用, ask the system, you have what content, the following is what it feedback to you 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 ## Plug-in procedures # #程序Storage engines # #存储引擎Table Maintenance # #表维护Transactions # #交易User-defined functions # #用户定义的函数Utility # #效用
2, we follow it to the instructions, to carry out the following inquiries
1) For example: we want to create a new 1 database, how to find the syntax?
Mysql>? The data definition #查看了上面的说明书, which should be in the figure how to define the face, so? Question mark it; You asked to help in the category: "Data Definition" For more information, type ' help <item> ', where <ite M> is one of the followingtopics:create DATABASE create EVENT Create FUNCTION create INDEX create LOGFILE GR OUP Create PROCEDURE Create SERVER Create TABLE create tablespace create TRIGGER ..... Several ellipsis options
2) The
mysql> ? create databasename: ' CREATE DATABASE ' Description:syntax:create {database | schema} [if not exists] db_ name #这次就找到新建数据库的语法了, directly create [create_specification] ... # #需要注意 {} curly braces 1,[] Optional can be ignored, other required create_specification: [default] character set [=] charset_name | [default] collate [=] collation_ Namecreate database creates a database with the given name. to use thisstatement, you need the CREATE privilege for the Database. createschema is a synonym for create database. Url: http://dev.mysql.com/doc/refman/5.6/en/create-database.html
3) The following is a new Qiuyuetao database based on the syntax of the system prompt
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 statements are divided into 3 categories
1) DDL : The language of the data definition, can you? Data definition to query
Create, alter, DROP, manage the underlying data: for example, libraries, tables
2)DCL: Data Control language-language
Grant, REVOKE, commit,rollback, user authorization, permission reclamation, data submission rollback
3)DML: Date manipulation Language-Data manipulation language
Select, Update, delete, insert, perform operations on tables and records
Hope that through the above content, to your help, if there are any questions, can communicate at any time, thank you.
This article is from the "funny Brother Notes" blog, be sure to keep this source http://qiuyt.blog.51cto.com/1229789/1923286
MySQL built-in Help parsing (SQL statement instructions)