Linked Questions

1
vote
0answers
33 views

2 AUTO INCREMENT COLUMNS in ONE TABLE [duplicate]

I have table named ITEMS where there should be 2 auto increment columns. So the table structure would be: ID | ITEM_ID --------------------------------- 1 | ITEM201521080225-001 2 | ...
6
votes
4answers
40k views

How to use 2 auto increment columns in MySQL phpmyadmin

Is it possible to use 2 auto increment values ? One starting from 0 Another starting from 4000400 Please help me
7
votes
1answer
18k views

MySQL get next unique value without auto increment

I have an MySQL database (InnoDB) that I'm developing for tracking Work Orders at my organization. There are multiple 'sites', and each site has work order numbers starting at 100. WorkorderID ...
5
votes
2answers
3k views

Should I replace my varchar primary key with an integer primary key?

I have a table that has a varchar primary key that's associated with "Base Product Codes". They rarely change, and if they do, it's usually just being deleted or added. I figured it would be better ...
6
votes
2answers
2k views

MySQL and AUTO_INCREMENT columns in multiple-column index for InnoDB tables: support status?

Missing support for AUTO_INCREMENT columns in multiple-column index for InnoDB tables is a widely known limitation, as is the trigger workaround for when it is needed (see e.g this post). Yesterday, ...
0
votes
1answer
3k views

How can you have a combined primary key for one table?

I have exactly the same question as posted here. But in my case I do not use MySQL but Postgres. Can this be done with Postgres? All things indicate I can not use a combined index in Postgres, so ...
1
vote
3answers
386 views

Optimize MAX or ORDER BY column DESC with LIMIT 1

I have a scenario where I need to Insert a new record and increase a sub-id. The Query is very slow. Exist any better Solutions for this? Table CREATE TABLE `link_` ( `id` bigint(20) NOT NULL ...
2
votes
1answer
698 views

Issues converting MyISAM table to InnoDB (auto column issue)

I'm having issues trying to convert a table from MyISAM to InnoDB in MySQL 5.6. The following is the table dump: -- -- Table structure for table `companies` -- DROP TABLE IF EXISTS `companies`; /*!...
0
votes
1answer
440 views

two auto incrementing columns

OK I have hit an issue, now I was going to look at having two auto incrementing columns, but I cant using InnoDB. So I am after a Solution. I have a table called queue. Everything to do with my task ...
1
vote
1answer
240 views

Mysql sequential numbering based on MAX of another column

I've a table lp_pictures which have these fields: [id | plate_uid] [1 | aaa] [1 | aaa] [1 | aaa] [1 | bbb] [1 | bbb] [1 | bbb] and i need to UPDATE the field id to becomes: [id | plate_uid] [...
0
votes
1answer
167 views

mysql - can a slave have a different primary key than the master?

I have a table with PRIMARY KEY (`id`) and I want to change it to PRIMARY KEY (`username`, `id`). These columns are defined as: `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `username` ...
2
votes
1answer
117 views

How to go about modeling the main object of relationship?

I'm using MySQL and MyISAM tables. I have a bunch of objects that I want to group together 1 object belongs to 1 and only 1 group 1 group can have many objects 1 group has 1 required main object ...