Created
July 19, 2015 16:18
-
-
Save Adejair/a2841df765b41284c86c to your computer and use it in GitHub Desktop.
DevStudy - Setando valores para o auto_increment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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