Skip to content

Instantly share code, notes, and snippets.

@Adejair
Created July 19, 2015 16:18
Show Gist options
  • Save Adejair/a2841df765b41284c86c to your computer and use it in GitHub Desktop.
Save Adejair/a2841df765b41284c86c to your computer and use it in GitHub Desktop.
DevStudy - Setando valores para o auto_increment
create database db_Teste;
use db_Teste;
create table if not exists table_incremento (
codigo smallint primary key auto_increment,
nome varchar(30) not null
) auto_increment = 15;
insert into table_incremento (nome) values ('Ana');
insert into table_incremento (nome) values ('João');
insert into table_incremento (nome) values ('sasha');
/* Selecionando o maior valor do auto increment de código. */
select max(codigo) from table_incremento;
select * from table_incremento;
/* Alterando o valor do proximo incremento */
alter table table_incremento auto_increment = 30;
insert into table_incremento (nome) values ('goku');
select * from table_incremento;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment