MySQL Tutorial/Database/Create Database — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:44, 26 мая 2010
Create a database
Syntax:
<source lang="sql">
CREATE DATABASE <database>;</source>
Creating a database does not select it for use
<source lang="sql">
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></source>
Database, Table, and Column Definition with Character and collate
<source lang="sql">
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</source>