zoukankan      html  css  js  c++  java
  • 删除数据库mysql

    drop命令用于删除数据库。

    drop命令格式:drop database <数据库名>;

    例如,删除名为 xhkdb的数据库:
    mysql> drop database xhkdb;

    [例子1] 删除一个已经确定存在的数据库:
       mysql> drop database drop_database;
       Query OK, 0 rows affected (0.00 sec)

    [例子2] 删除一个不确定存在的数据库:
        mysql> drop database drop_database;
        ERROR 1008 (HY000): Can't drop database 'drop_database'; database doesn't exist
        // 发生错误,不能删除'drop_database'数据库,该数据库不存在。

        mysql> drop database if exists drop_database;
        Query OK, 0 rows affected, 1 warning (0.00 sec)
        //产生一个警告说明此数据库不存在

        mysql> create database drop_database;  // 创建一个数据库
        Query OK, 1 row affected (0.00 sec)
        mysql> drop database if exists drop_database;  // if exists 判断数据库是否存在,不存在也不产生错误
        Query OK, 0 rows affected (0.00 sec)

  • 相关阅读:
    CodeForces 514B
    CodeForces 514A
    UVa 818
    HDU 1003
    UVa百题总结
    UVa 11526
    UVa 12412
    UVa 211
    UVa 1587
    UVa 225 – Golygons [DFS+剪枝]
  • 原文地址:https://www.cnblogs.com/adolfmc/p/4749230.html
Copyright © 2011-2022 走看看