Most voted "auto-increment" questions
A database restriction, which automatically increases from the last record when making an INSERT. You can use the tag for any database that uses some auto-increment mechanism
Learn more…33 questions
Sort by count of
-
6
votes1
answer3098
viewsHow to customize Auto_increment numbering in Mysql?
I have a column Contrato in my Mysql database, it is like Auto_Increment, by numbering the contracts as 1, 2, 3... But I needed, if possible, to organize these numbers in the actual format of…
-
6
votes2
answers531
viewsMysql Auto increment even number
I have a Mysql database with a field id that is AUTO_INCREMENT. Has some configuration problem in it because when doing auto increment is coming out exactly in this sequence: ID: 2 ID: 12 ID: 22 ID:…
-
5
votes4
answers18077
viewsHow to organize auto-increment numbering of a column Id of a table in Mysql?
I would like after each insert or delete from my table to use an SQL script to rearrange the Ids. It’s kind of like this now: Id Nome 1 João 3 José 5 Ricardo I want to leave it like this: Id Nome 1…
-
5
votes1
answer1718
viewsHow does auto increment work with composite keys in the Myisam engine?
I ended up taking a table to manipulate, I noticed that sometimes the value of auto increment repeated, the first thing that called me the attention was that the key Primary was composed of two…
-
5
votes3
answers860
viewshow to increment letters in php?
I need to make a script in php that increments a letter in the received name ex: if the user type B letter need to transform it into a forward or C.
-
3
votes1
answer48
viewsPrint form with: 1.photo in the post 2. id auto increment generated in the form Insert. How is it in PHP?
At the time of registration of the form the user will put the photo, so far so good. My problem is that I need to print this form already with the photo and the id auto increment of the database.…
-
3
votes1
answer698
viewsCan too high an ID (auto-increment) be harmful?
I have a table that has a very high turnover of information, that is, many records enter and many leave as well. With this the ID (auto-increment) is much higher than the value of data in the table.…
-
3
votes2
answers835
viewsHow to make an auto ID increment relative to another field in Postgresql "Postgresql"?
Personal it has been a long time since I look for a way to do this, what would be the correct way to make an auto increment that depends on another field as in the example below? id_empresa |…
-
2
votes1
answer109
viewsProperty containing only the Keyattribute attribute resulting in auto-increment column in the database
If I’m not mistaken, this must have come in version 6.1.1 of Entityframework and it wasn’t like this in previous versions. I believe a column only became auto-increment when the attribute…
-
2
votes1
answer183
viewsLearn ABC in C language?
As I do in this code, when he type a letter read by the keyboard with the type scanf (char) it repeats until the Z? #include <stdio.h> #include <stdlib.h> int main() { char c; /*for (c=…
-
2
votes0
answers179
viewsAuto ID increment relative to another field
I have been looking for something to solve such problem that I have been finding in other systems that I developed, I would like to know a solution for how to make an id auto increment, but an auto…
-
2
votes2
answers662
viewsSet Auto Increment position, always for the smallest ID
I have a database Mysql, where contains a table called usuarios This table contains a column ID, where is Autoincrement and kind INT I need you to: Whenever I enter the first result the ID be equal…
-
2
votes2
answers189
viewsmongodb getNextSequence error is not defined
Good morning, I am unable to create and execute this function in mondodb 3.4 I’m following this tutorial: Create an Auto-Incrementing Sequence Field Error Error: Referenceerror: getNextSequence is…
-
1
votes2
answers234
viewsAuto increment ID value
In my Mysql Workbench I have 4 tables with auto increment id. But when I fill out the form it adds values not followed. For example: I fill out a form for the first time and the ID it puts me is 3.…
-
1
votes1
answer1769
viewsHow to insert UUID automatically into a Mysql Database?
Is there any way to insert a UUID automatically in a table field, in the same way as with a field of the type AUTO_INCREMENT? In a framework for PHP, Cakephp, when defining the primary key as…
-
1
votes1
answer82
viewsUnexpected result in C program
In that code: #include <stdio.h> #include <stdlib.h> int main() { int x, y = 10; //incrementa depois atribui y = ++x; printf("x = %d\n", x); printf("y = %d\n", y); system("pause");…
-
1
votes1
answer656
viewsRedo autoincrement on Sqlite
I am passing the data from an old bank to a new bank. After running all the querys there were some primary key fields that were "missing". Example by column id jumped from data '11' to data '13'…
-
1
votes2
answers286
viewsCan you get the value of an autoincrement column before it is saved in the database?
I have three tables: preco, estabelecimento and precoXestabelecimento. The id of price is autoincrement and there is a relationship N:N between the first two tables, which is represented by the…
-
1
votes2
answers740
viewsDoubt increment $i + loop for
Colleagues, sometimes I come across some snippets in the code used the variable $i before the repeat loop ($i = 0) and in the middle and end $i++, as the examples below: Ex1) $c = count($obj); $i =…
-
1
votes1
answer477
viewsHow to increment the index of an unlimited array?
How can I increment an array within a structure? This is my structure: struct list { char name[50]; int products_list[]; } LIST[10]; I wanted to know the current number of elements in the array…
-
1
votes1
answer206
viewsCreating a loop with php and mysql
I need a help to create a function in PHP. I have a table in the bank at Mysql, where in a column I want to vary the numbering from 1 to 4 per record. For this I have a form where the client fills…
-
0
votes1
answer355
viewsHow to generate sequential numbers automatically with current year in Rails?
I need that when a new product is created it generates a number ex: 0001/2015 numero/ano_in effect and when it changes year back to zero. I made a helper just to format the number in the views, but…
-
0
votes1
answer522
viewsHow to reset the auto_increment value (NO TRUNCATE)?
How can I reset/reset the value of AUTO_INCREMENT in the Mysql, without the use of TRUNCATE? For in some cases it is not possible to use TRUNCATE table in some tables.…
-
0
votes1
answer99
viewsHow to change a Primary key to Auto_increment Constraint
I created the following table create table if not exists cursos( nome varchar (30) not null unique, descicao text, carga int unsigned, totaulas int, ano year default '2018' )default charset = utf8;…
-
0
votes1
answer416
viewsIntersection between same table, auto relationship, mysql with INNER JOIN
Hello, I’m making a facebook clone database. I have two tables, one of users and another friendship. The friendships table is a self relationship of users as shown in the image. This table of…
-
0
votes2
answers206
viewsMysql - auto increment shared between tables
It is possible to share the auto increment value of two tables? Example: Tabela 1 +----+-------+-----------+ | id | campo | criado_em | | 1 | a | 00:00 | | 2 | b | 01:00 | | 5 | c | 04:00 |…
-
0
votes1
answer46
viewsIs it possible to loop with "0" on the left in PHP?
Dear Devs, I’m trying to use a list with zero left using for and str_pad, but I’m not getting the variable with 0 left, the first variable comes complete but in the autoincrement it’s counting…
-
0
votes2
answers62
viewsHow to generate auto increment field, in Django models, that is not PK, and that depends on information from another field that is FK?
I’m developing an application in Django that has two models, Modality and Bidding. The Bidding has a FK field (models.Foreingkey), which pulls the Modality. I would like this field to generate an…
-
0
votes1
answer27
viewsPOST method in the ASP.NET Controller API is auto-incrementing foreign key even if the value should be empty
I have the following code: public ActionResult Post(Project project) { try { _acess.AddProject(project); } catch(DataException ex) { BadRequest(ex.Message); } return Ok(); } Sent JSON object: {…
-
0
votes1
answer63
viewsWhat are the advantages and disadvantages of using Auto Increment Field in Firebird?
I’ve heard of some people who use Campo auto increment can give complications in the database on account that it can make several jumps in the numbering and even get lost in the counts. I don’t know…
-
-2
votes1
answer56
viewsReordering Autoincrement in SQL
Eae guys, like I created an ID table with Auto Increment, checking the table ví Bugou, have any SQL commands that reorder from 1,2,3,4 to last? just more for the sake of reorganization. Thank you.…
-
-2
votes1
answer1151
viewsColumn id with Primary key and auto increment is returning null MYSQL PHP
Good evening guys, it is the following, I have an application that was working until these days, then today when I went to add a post in the database, my id_post that is Primary Key and…
-
-2
votes1
answer33
viewsReorder AUTO_INCREMENT correctly
Hi, I need to reorder the field AUTO_INCREMENT in the Mysql to stay in the correct sequence. Searching, I managed to do it but when I enter a new record, it gets the Id continued from the previous…