MySql单表的curd-04

truncate 清空表 ★
格式:
truncate 表名; 干掉表,重新创建一张空表
和delete from 区别:
delete属于DML语句 truncate属于DDL语句
delete逐条删除 truncate干掉表,重新创建一张空表

auto_increment 自增
要求:
1.被修饰的字段类型支持自增. 一般int
2.被修饰的字段必须是一个key 一般是primary key

create table ai01(
id varchar(10) auto_increment
);-- 错误 Incorrect column specifier for column 'id'

create table ai01(
id int auto_increment
);-- 错误 Incorrect table definition; there can be only one auto column and it must be defined as a key

posted @ 2017-04-23 21:02  蒋酱酱  阅读(201)  评论(0编辑  收藏  举报