程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> mysql 創建數據庫,刪除數據庫實例

mysql 創建數據庫,刪除數據庫實例

編輯:MySQL綜合教程

mysql教程 創建數據庫教程,刪除數據庫實例

CREATE DATABASE <database>;
 
mysql>
mysql>
mysql> CREATE DATABASE myDatabase;
Query OK, 1 row affected (0.03 sec)

mysql>
mysql> drop database myDatabase;
Query OK, 0 rows affected (0.01 sec)

mysql>
Under Unix, database and table names are case sensitive.
Under Windows, this restriction does not apply
mysql>
 
用use改變當前表

mysql>
mysql>
mysql> CREATE DATABASE myDatabase;
Query OK, 1 row affected (0.02 sec)

mysql> USE myDatabase;          -- Select it manually
Database changed
mysql> drop database myDatabase;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>

縮合上面的實例

mysql>
mysql> CREATE DATABASE myDatabase DEFAULT CHARACTER SET latin2 COLLATE latin2_czech_ci;
Query OK, 1 row affected (0.02 sec)

mysql>
mysql>
mysql>
mysql> USE myDatabase;
Database changed
mysql>
mysql> CREATE TABLE myTable
    -> (
    ->     c1 CHAR(10)
    -> );
Query OK, 0 rows affected (0.03 sec)

mysql>
mysql> drop table myTable;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> drop database myDatabase;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> use test;
Database changed

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved