delete.md 471 字节
Newer Older
M
Mars Liu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# Delete

下列删除语句中,有错误的是:

## 答案

```sql
delete from cust(id, last_name, first_name, city) where id = 5;
```

## 选项

### 在生产环境不带 where 的 delete 是极度危险的操作,但是它仍然合法

```sql
delete from cust;
```

### 标准的删除操作

```sql
delete from cust where id=2341;
```

### 删除操作可以带有子查询

```sql
delete from cust where id in (select id from cust where city='Tian Jin');
```