Questions tagged [auto-increment]

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

AUTO_INCREMENT is a flag set on a field in a database table that forces the RDBMS to create a unique identifier for the record. This is useful when no other obvious primary key field is apparent in a record.

Useful questions

Related tags

2677 questions
0
votes
2 answers

MARIADB sequences - incrementing by 2

I have the following MARIADB code. It's supposed to demonstrate: Constructing tables using sequences for incrementing the ID. Using a temporary table+join to INSERT data into a table, while incrementing the ID. Procedure: Sequence S1 and table T1…
0
votes
2 answers

Set a column value based on a condition

I am using a table on a Postgres DB. I have a table with the following columns: ID STATE LOB CREATED TIMESTAMP SUBMISSION NUMBER SUBMISSION AMOUNT This table is being updated by 2 different insert queries: One where we receive the value of…
PPSATO
  • 95
  • 7
0
votes
1 answer

Auto-increment ID in create method in ASP.NET MVC

I create a controller for Category table and have generated CRUD metods. In the CREATE action method, how can I make the CategoryID input disappear, and after entering CategoryName, the CategoryID column will automatically increment when adding a…
Abapito
  • 73
  • 7
0
votes
0 answers

why Php increment count session twice per page load?

My wordpress php script is incremented by two instead one. ++$_SESSION['visitor'] is incremented by two ! In functions.php if ( !isset( $_SESSION['visitor'] ) ) $_SESSION['visitor'] = 1; else ++$_SESSION['visitor']; I have to do this in echo to…
imagIne
  • 49
  • 1
  • 6
0
votes
1 answer

Calculation issue on self incremention

I've this issue in my script code. The abc indicator each bar is a sum of value of abc on previous bar + the value of formula volume*(close - close[1])/close[1] I don't undrstand why plotting abc I've alway zero…
Gulymin
  • 11
  • 1
0
votes
0 answers

Auto increment in MongoDb is not working in Express NodeJS

exports.addToCart = async(req,res)=>{ const cart = await schema.cart.findOne({username:req.body.username}) if(cart){ return res.status(404).json({ message:"User's cart is already available, append to the same…
0
votes
1 answer

Auto increment column in SQL server with select

Hello I am populating a table with data from a different table. These are both pre-existing tables that have data in them. My script is almost working. It selects the appropriate values from the selection table and inserts the new record into the…
tcoady
  • 15
  • 4
0
votes
2 answers

SQLITE - Update table with auto-incremented id by group

I have a table on a format as below: CREATE TABLE my_data ( category TEXT, projectName TEXT, fileName TEXT, fileLine TEXT, fdate DATETIME, -- other columns... groupid NUMBER ); Currently, groupid is NULL in all rows. I…
Carrol
  • 1,225
  • 1
  • 16
  • 29
0
votes
1 answer

Why Postgres id column serial4 type not increment by 1 even not deleting

In postgres 11.2 I created a table with id serial4 NOT NULL, I thought the id would always increment by 1 but I noticed it's not. Table Order creation SQL CREATE TABLE public.order ( "createdAt" timestamptz NOT NULL DEFAULT now(), …
JasonHsieh
  • 553
  • 1
  • 6
  • 20
0
votes
0 answers

Postgres - DB backed without data but PK is not autoincrementing correctly

I wanted to backup my db with no data, but my PK is autoincrementing in no order. On some tables it goes 1,3,5,6,7.., some columns it is 1,3,4.. and some columns even start from 2. Here is my sql code example: SET statement_timeout = 0; SET…
Lube
  • 318
  • 1
  • 12
0
votes
1 answer

Create a SQLAlchemy Model Object Without Updating an Auto-Incrementing Column

I have a Model with an auto-incrementing primary key. I want to be able to create an object from that model without an id, throw it away, and not have that Column's id auto-increment. Is that possible? Assigning MyModel(id=None) does not do…
thekthuser
  • 706
  • 1
  • 12
  • 28
0
votes
1 answer

Increment Last Id from String in python Django

I am trying to generate an auto-increment number as an ID with Company Label. Company Labels will be changing for every user. So I cant use slicing here. My ID is like TES-PRODUCT-01 TES is a company label PRODUCT is as it is name But now I wish…
0
votes
1 answer

Databricks- Autoincrement identity- How to insert the changes from latest cdf version

I have an autoloader table processing a mount point with CSV files. After each run, I would like to insert some of the records into another table where I have an AutoIncrement Identity column set up. I can rerun the entire insert and this works, but…
0
votes
1 answer

How to create a SQL autoincrement ID only when conditional requirements are met

I am trying to create a new ID for a dataset which will identify and group people together when certain conditions are met, for example a shared address. I'm trying to add an autoincrement column that creates this ID for those people, so I could see…
0
votes
1 answer

Azure mapping data flows - insert rows into two sink sequentially

I am implementing a data flow in which I need to insert rows into two different sink and both of the sink are Azure SQL database tables. The first sink i.e. the first Azure SQL database table has an auto generated ID column. After inserting values…
1 2 3
99
100