create_database.md 909 字节
Newer Older
M
Mars Liu 已提交
1 2 3 4
# 创建和删除数据库

Joe 在开发机上创建了一个名为 goods 的数据库,做了一些练习,现在他需要删除这个数据库,重建一个 goods。那么他需要的步骤是:

M
Mars Liu 已提交
5 6
点击进入[MySQL实战练习环境](https://mydev.csdn.net/product/pod/new?image=cimg-centos7-skilltreemysql&connect=auto&create=auto&utm_source=skill)

M
Mars Liu 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
## 答案

```mysql
drop database goods;
create database goods;
```

## 选项

### A

```mysql
delete database goods;
create database goods;
```

### B

```mysql
if exists(database goods) then
begin 
    drop database goods;
end;
create database goods;
```

### C

```mysql
use goods;
drop database goods;
create database goods;
```

### D

```mysql
use goods;
drop database goods;
make database goods;
```

### E

```mysql
drop database goods;
make database goods;
```

### F

```mysql
cd goods;
drop database goods;
create database goods;
```