drop sequence seq_stu
create sequence seq_stu
start with 22
Increment by 1
maxvalue 999
nocache
nocycle;
--这是最详细的一种序列的创建,指定了序列从22开始,到999结束,每次使用后都自增1
create sequence seq_stu
--这是最简单的一种序列的创建方式,指定了序列从1开始,每次使用后都自增1
drop sequence seq_stu;
--删除序列(seq_stu为序列名)
insert into stu(stu_id) values(seq_stu.nextval)
1、删除该序列,再重新创建该序列即可 2、 truncate table 表名; 注意:截断表,即删除所有数据,只保留表结构
create table emp(
emp_id int primary key auto_increment,
emp_name varchar(10),
hire_date date,
birthday date,
salary int,
dept_id int,
FOREIGN key(dept_id) REFERENCES dept(dept_id)
)auto_increment = 1000;
--auto_increment = 1000作用是从字段数字从1000开始
TRUNCATE TABLE 表名;
注意:会删除表中的数据,只有在MySQL中,TABLE字段可省略
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有