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>
实例二,创建一个数据库并设置为当前数据库
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> 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