zoukankan      html  css  js  c++  java
  • MYSQL 第三章 基操

    基本操作增删改查

    mysql> show databases;    #查看databases   记住后面要加s
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | employees          |
    | mysql              |
    | performance_schema |
    | sys                |
    | test               |
    | test_db_char       |
    +--------------------+
    7 rows in set (0.00 sec)
    
    mysql> show database like 'te%';
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database like 'te%'' at line 1
    mysql> show databases like 'te%';    #使用 like 关键字进行模糊匹配查询  '%te%' , 'te%' , '%te'
    +----------------+
    | Database (te%) |
    +----------------+
    | test           |
    | test_db_char   |
    +----------------+
    2 rows in set (0.00 sec)
    
    
    mysql> show create database test;   #查看已经创建的  database 的信息 ,不需要加s 
    +----------+--------------------------------------------------------------------------------+
    | Database | Create Database                                                                |
    +----------+--------------------------------------------------------------------------------+
    | test     | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */ |
    +----------+--------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> create database user_zy;      #create  关键字创建数据库
    Query OK, 1 row affected (0.00 sec)
    
    mysql> show create database user_zy;   #查看信息
    +----------+--------------------------------------------------------------------+
    | Database | Create Database                                                    |
    +----------+--------------------------------------------------------------------+
    | user_zy  | CREATE DATABASE `user_zy` /*!40100 DEFAULT CHARACTER SET latin1 */ |
    +----------+--------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | employees          |
    | mysql              |
    | performance_schema |
    | sys                |
    | test               |
    | test_db_char       |
    | user_zy            |
    +--------------------+
    8 rows in set (0.00 sec)
    
    mysql> alter database user_zy default character set utf8;   #alter 关键字修改数据库信息
    Query OK, 1 row affected (0.00 sec)
    
    mysql> show create database user_zy;
    +----------+------------------------------------------------------------------+
    | Database | Create Database                                                  |
    +----------+------------------------------------------------------------------+
    | user_zy  | CREATE DATABASE `user_zy` /*!40100 DEFAULT CHARACTER SET utf8 */ |
    +----------+------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> drop database if exists user_zy;
    Query OK, 0 rows affected (0.01 sec)
    
    

     mysql> use user_zy;   #use 关键字选择数据库
     Database changed
     mysql>




    帮助:

    mysql> 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
       Contents
       Data Definition
       Data Manipulation
       Data Types
       Functions
       Geographic Features
       Help Metadata
       Language Structure
       Plugins
       Procedures
       Storage Engines
       Table Maintenance
       Transactions
       User-Defined Functions
       Utility
    
    mysql> help 'Account Management';  #查询指定信息
    
    You asked for help about help category: "Account Management"
    For more information, type 'help <item>', where <item> is one of the following
    topics:
       ALTER USER
       CREATE USER
       DROP USER
       GRANT
       RENAME USER
       REVOKE
       SET PASSWORD
    
    mysql> 
  • 相关阅读:
    ExtJS5入门
    时间序列异常检测
    RNN实例
    数据清洗入门
    异常检测LOF
    sklearn异常检测demo
    孤立森林(Isolation Forest)
    WCF初见之SQL数据库的增删改查
    NHibernate与EF(Entity Framework)的区别
    解决IIS7虚拟目录出现HTTP 错误 500.19(由于权限不足而无法读取配置文件)的问题
  • 原文地址:https://www.cnblogs.com/zy09/p/12973877.html
Copyright © 2011-2022 走看看