作用删除表里的记录行(都是整行整行的删除的)
语法:
delete from 表名 where 要删除的记录筛选条件;
案例:删除员工编号大于203的员工信息
delete from employees where employee_id>203;
语法:
- delete 别名1,别名2
-
- from 表1 别名1,表2 别名2
-
- where 连接条件 and 筛选条件;
注意:如果只删表1的就只写别名1,如果两个表的记录都删就别名1,别名2)
- delete 别名1,别名2
- from 表1 别名1
- [连接类型] join 表2 别名2
- on 连接条件
- where 筛选条件;
- 案例:删除任波涛的年龄信息
- delete a from students s
- inner join ages a
- on s.age_id = a.id
- where s.name='任波涛';
不能加where条件
truncate table 表名;