Questions tagged [auto-increment]

a database constraint that automatically increases from the last record when making an INSERT

Filter by
Sorted by
Tagged with
-2 votes
1 answer
43 views

AUTOINCREMENT vs No AUTOINCREMENT in SQLite

I put and did not put AUTOINCREMENT for id in person table as shown below: CREATE TABLE person ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT # ↑↑↑↑↑↑↑↑↑↑↑↑↑ ); CREATE TABLE person ...
Super Kai - Kazuya Ito's user avatar
0 votes
1 answer
23 views

How to create a string sequence in SQLAlchemy

I am currently developing an API for invoices. And I want to create an Invoice table with invoiceNumber field that would be auto incrementing but as a string. Something like this: INV00001 INV00002 ...
Vitalij Gurin's user avatar
0 votes
1 answer
42 views

Obtaining a combined key (year/number) in mysql with innoDB storage engine

I would like to create a combined key in an innoDB table that already has an "ID" column with auto incrementing value that works as primary key. Assuming we have the following "...
Alex's user avatar
  • 13
0 votes
0 answers
7 views

I modified the auto-increment on an index and when I create a new record I get 2 new records

When I create a new record I get 2, each with a different index value. I wanted to add auto increment to my index, and I did, but it was already defined as auto-increment, so I did it twice!! How can ...
user1897618's user avatar
-1 votes
1 answer
84 views

SQL Lag Increment By 1

I am trying to use the LAG function to add 1 to every row, with '1' as the default value. For example; SELECT T.NAME, T.SESSION, LAG (CASE WHEN T.SESSION = 2023 THEN '1' END, 1, 0) OVER (...
GBM's user avatar
  • 101
1 vote
0 answers
46 views

Assigning a persistent and unique ID to instances of a python class

There are a number of threads on SO dealing with a similar question, e.g. How to create a unique and incremental ID in a Python Class Auto-incrementing IDs for Class Instances How do you create an ...
Nick's user avatar
  • 2,944
-1 votes
1 answer
35 views

innodb missing auto-increment values [duplicate]

I am not experienced in this area. Can you tell me why autoincrement skips values? This is my table: CREATE TABLE `orders` ( `id` int NOT NULL AUTO_INCREMENT, `product_id` int NOT NULL, `...
beslana's user avatar
1 vote
1 answer
59 views

Is it guaranteed that bigserial column is unique across all partitions of a partitioned table?

I created the partitioned table in Postgres 15 with composite primary key: CREATE TABLE T ( id bigserial NOT NULL, date date, ..., PRIMARY KEY(id, date) ) PARTITION BY RANGE (...
user3440012's user avatar
0 votes
1 answer
38 views

Auto incrementing does not occur when adding an item in PostgreSQL using Hibernate

I created a table in PostgeSQL with data for a person and marked the column "id" with the type 'SERIAL' as 'primary key', 'not null' CREATE Script: CREATE TABLE people ( id serial NOT NULL,...
Артем Лебідь's user avatar
1 vote
1 answer
23 views

What Liquibase XML element to use to reset AUTO INCREMENT counter for a column in MySQL?

In MySQL you would use this kind of SQL to reset the AUTO INCREMENT counter for a table: ALTER TABLE my_table AUTO_INCREMENT = 200; What is the corresponding XML element to use in Liquibase? I'm ...
Neek's user avatar
  • 7,201
0 votes
0 answers
14 views

Auto incremented value not persist in persistent object after transaction commit until session closed

I have Entity with generated "Id" as well as another attribute call "code" with auto incremented value. After call session.persist(entity) and transaction.commit() the value of &...
SLMORA's user avatar
  • 21
0 votes
1 answer
40 views

How to automatically increment Django IntegerField

I have a field in my model Step=models.IntegerField() I call it normally in the template with the following: {{user.step}} Now I want this field to automatically increase after every year What is ...
Raji Muhammad's user avatar
0 votes
0 answers
16 views

auto increment of number in terraform

actually i am trying to provision ec2 instance from ServiceNow catalog through terraform script. when provisioned the ec2 instance the name will be something be like abc001A , second time when trying ...
Selvi Velmurugan's user avatar
0 votes
0 answers
35 views

Change ID in MySQL table permanently [duplicate]

How can I change the value of the ID in a MySQL table, for example, to "9999," while keeping the remaining IDs (1-315) unchanged and ensuring that the next autoincrement value is actually ...
user2144969's user avatar
0 votes
0 answers
35 views

PHP file_put_contents() make a primary key that auto_increments

this is my first time asking a question since I cant find any better solutions for my problem. I got a task to make a form by website that uses file_put_contents() for book data library. My code ...
Faisal Wildan H's user avatar
1 vote
2 answers
53 views

MySQL insert varchar value into int auto increment column

I noticed strange MySQL behaviour on projects staging server. Given: create table test_table ( id int auto_increment, name varchar(64) not null, constraint test_table_pk primary ...
Marius's user avatar
  • 25
0 votes
0 answers
47 views

Ms access database has skipped an auto increment number (ID) after repare. How to restore it?

I have Microsoft access database. I have about 1200 records, with attached documents through forms and am generating several reports with it. While doing data entry access just halted and I restarted. ...
Tahir Hussain's user avatar
-1 votes
2 answers
115 views

SQLite integer primary key without assignment/autoincrement

I have a table which requires unique IDs for each row, and which requires them to be stable if the database is rebuilt (so I can't just use rowid), but does not require that they be unique over the ...
P...'s user avatar
  • 655
0 votes
1 answer
61 views

Add incremented variable in jquery ajax success handler

I want to increment the value of a variable ii, but its value does not change. If I move ii++; before the alert function call, it increases but the value set to #spanstatus is always 0. How do I ...
Hida's user avatar
  • 154
0 votes
1 answer
348 views

Entity Framework trying to add null primary key with auto increment

I'm starting a new Blazor project using Entity Framework 7 and an existing database. I created a class refering to a existing table from my database. public class IEA_EtatsDemandes { public ...
Valter's user avatar
  • 63
0 votes
1 answer
64 views

MySQL - Single auto increment with multiple primary keys or a safe way for insert with max()+1 in MySQL

I am looking for a solution two have my second primary key column to be auto incremented depending on the first primary key. Think about the following example case to comprehend the aspects of my goal:...
Sercan Samet Savran's user avatar
-1 votes
2 answers
244 views

Numbering invoices yearly and different structures with SQL and PHP [duplicate]

I'm a beginner in SQL and I tried looking for an answer without any luck. I would like to generate invoice numbers automatically with the following distinctions: I have 2 different structures ...
TheGix's user avatar
  • 108
0 votes
0 answers
38 views

How do I import posts into a new wordpress site if post ID starts at 26?

I want to use the WordPress export tool to export my posts from an old site. My concern is that the post ID in the old db starts at 26 and the destination database which is a fresh install obviously ...
MohsinG's user avatar
  • 121
0 votes
1 answer
342 views

How to keep the auto-increment function (in SQL IDENTITY) for ID after importing from Access to SQL Server?

I'm importing tables from Access to SQL Server. The column ID in Access is auto-increment, but in SQL Server I must enter every time the ID. It's important to say that there're records in the imported ...
zaraboy's user avatar
  • 11
0 votes
1 answer
159 views

Auto increment by group mariaDB

I have this MariaDB table. id order name forum_id 1 1 .... 1 2 2 .... 1 3 3 .... 1 4 1 .... 2 5 2 .... 2 where id is PK. ...
aoz's user avatar
  • 7
0 votes
0 answers
44 views

How to use DirectQuery Data Connectivity Option on Microsoft Power Bi with MYSQL DB?

I downloaded the latest option of Microsoft Power Bi and I'm visualizing data from a MySQL DB, however when importing the data set into Power Bi I stopped seeing the option to pick a Data Connectivity ...
Jaiylon's user avatar
  • 73
0 votes
0 answers
13 views

Why Auto Increment dont update

When inserting a row into my table, the auto increment value for my next insertion does not increment. Similarly in phpmyadmin I can't change this value manually. Auto Increment
NIKO's user avatar
  • 1
0 votes
1 answer
210 views

Sequelize ORM - Auto-increment function not working for new user creation in database

I use sequelize ORM. I have created a register route and controller to create new user. I created a new user with AVA test, but the auto-increment function isn't working properly. Despite being the ...
vetheve's user avatar
  • 209
0 votes
1 answer
33 views

root - ERROR - post - 46 - Record creation failed: (1062, "Duplicate entry '23SNS0002' for key '' ")

from django.db import models from django.utils import timezone import datetime class Employee(models.Model): emp_id = models.CharField(editable=False,unique=True,max_length=10,default=None) def save(...
Gokulnath's user avatar
0 votes
1 answer
149 views

How to add an Auto Increment Primary Key to a MariaDB System Versioned Aria table

I've made a bit of a mistake and I cannot correct it. I have a table Email and I've used the email address as the Primary Key. This is a mistake and I want to add an Auto Increment ID to the table ...
İan Boddison's user avatar
0 votes
0 answers
28 views

Why MYSQL auto-increment doesn't work when i insert a row?

When my web application wants to insert new rows in the mysql product table, it's always the same id that is inserted. Except that this creates errors because the identifier must be unique. The auto-...
NIKO's user avatar
  • 1
0 votes
0 answers
10 views

how to add a prefix with triggers in mysql? [duplicate]

I have the products table with id(auto_increment) and product fields. After each INSERT into the products table, I want the product name to be prefixed with the id value Using the instructions below, ...
Marcus Vinícius's user avatar
0 votes
0 answers
65 views

How to make an app on MIT App Inventor that can use real times and dates?

Is there a way/how can I access real satellite times and dates to utulize in, for example, a scheduling app on mit app inventor? I would really appreciate help, as there is a project that I have been ...
ShdwR's user avatar
  • 1
0 votes
0 answers
55 views

Variable Name Duplicates when Incrementing

I am trying to convert a variable name function I wrote for a smaller set of data to a larger one and have run across a problem of creating duplicate variable names because of the size of the set. I ...
Taylor Townes's user avatar
1 vote
1 answer
267 views

MySQL auto increment column on update to unique value

I have a table that looks something like: name: posts columns: - id - sequence_id - text - like_count The ID is a standard auto-incremented unique integer index. The sequence ID should be similar — ...
Logan Shire's user avatar
  • 5,013
-2 votes
1 answer
88 views

How to automatically assign a new number as a key in the dictionary whenever the user wants to add an item?

For example, I have an empty dictionary called a shopping list. and it shall store keys such as #"1,2,3,4..." and the value should be a list that store the name and price of item. For some #...
Chin Fung Chan's user avatar
0 votes
0 answers
24 views

How to insert into an autogenerated column in EF?

A column in our API tables is set as follows in Entity Framework. The underlying Oracle database also has a formula for generating a number if passed "0". What does StoreGeneratedPattern ...
CDove's user avatar
  • 1,940
0 votes
0 answers
145 views

google sheets checkbox increment counter

I am making a checkbox inventory counter that auto increments I have tried many if then statements to increase a cell value when a box or multiple boxes is check. The best I could do was display a ...
boyd maher's user avatar
1 vote
0 answers
77 views

How can I make ID field in MySQL immutable

Is there are way to make ID fiels in MySql immutable? It's possible in postgreSQL using PGAdmin for example. ID field sets as primary key and auto incr but can be changed manually.
Vandal's user avatar
  • 21
0 votes
1 answer
157 views

Auto Generate Incrementing Number

The question I have is that I'm trying to auto-generate a number incrementally every time a user creates a new record. I'm trying to have the field auto-generate a number as soon as a person wants to ...
markymark_prod's user avatar
1 vote
3 answers
70 views

DBD::DB2: why does a `$dbh->disconnect` cause gaps in an autoincrement column?

Why does the $dbh->disconnect cause gaps in the auto-increment column? use DBI; my $db = 'MYDB2'; my $table = 'SCHEMA.TABLE'; my $user = 'user'; my $pass = 'passwd'; my $dsn = "dbi:DB2:$db&...
sid_com's user avatar
  • 24.2k
0 votes
0 answers
17 views

How to create sequential (primary) id that is constrained to another id or parameter? [duplicate]

I am creating an Invoicing Application and I am using sequelize. I want the invoice code (or id) to be sequential per (end-) user profile; not throughout the system/database. For instance, let us ...
Monero Jeanniton's user avatar
1 vote
1 answer
164 views

Creating a new mysql AUTO INCREMENT column from hibernate entity class

From the sources of information in stack overflow, I have understood that we can use an already created auto increment column in mysql table using the @GeneratedValue(strategy=GenerationType.IDENTITY) ...
Nar1989's user avatar
  • 21
0 votes
2 answers
146 views

MySQL - auto increment by more than one?

I have a table with a primary key using AUTO_INCREMENT. I want this column to start at 1 and increment by 3, but I can't find how to increase the amount the column increments by. ALTER TABLE tbl ...
conner.mcvay's user avatar
0 votes
0 answers
32 views

(mongoose-sequnce)(mongoose) + Hapijs Adding auto increment in schema field

I want to add an auto-increment field in the MongoDB schema for Interview.round.count field i.e. whenever I will Update the interview field it will automatically increase the Count value with +1 //...
RK Varun's user avatar
0 votes
1 answer
84 views

Google Sheets Auto Increment [duplicate]

I've been building a sheet for work and I want an auto incremented ID, which I can later use to FILTER or VLOOKUP the results back into a dashboard. I've found a "tutorial" online, regarding ...
Jan de Pauw's user avatar
0 votes
4 answers
423 views

Auto increment by 2 starting from 1000

I’m using MySQL to make a table: CREATE TABLE school.student( Std_id INT NOT NULL AUTO_INCREMENT, Std_name CHAR(40) NOT NULL, Std_Birth DATE, Std_Group CHAR(2) check(Std_Group in ('G1',...
blue kitten's user avatar
0 votes
1 answer
123 views

Conditional segmented auto increment in Postgres

class Ticket{ int id; int caseId; int orderNumber; } Lets imagine I can't change data structure. The order is always have to be without jumps (1,2,4 not good) in range of one caseId, ...
Ludov Dmitrii's user avatar
0 votes
3 answers
83 views

Need assistance with a google sheets formula (incrementing issue)

I'm using this formula to ref from one google sheet to another. =IMPORTRANGE("https://docs.google.com/spreadsheets/d/1HKmUMM4vLvNt9Z20Yc_VyrDx25MxlDQlJjTAXtHl-p4/edit#gid=397776635", "...
Nats79's user avatar
  • 1
0 votes
0 answers
124 views

How auto increment work for parallel bulk inserts

I have an application that processes files and transform them to bcp files that are imported into a SQL server database using bulk insert. The application is using parallel threading, and as result ...
user123's user avatar
  • 387

1
2 3 4 5
54