A table is:
mysql> desc gifts;
+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| giftID | int(11) | NO | PRI | NULL | auto_increment |
| name | v...
Hello. I have 30 divs with the same class on the same page. When i'm pressing the title (.pull) the content is sliding up (.toggle_container). When the content is hidden and i'm pressing the title again, the content is sliding down. Also, i want to store the div state inside a cookie.
I modified my original code to store the div state in...
I needed an id field in my rails migration that auto-increments from 0 and not 1.Any idea?
Thanks & Cheers !
...
Hi,
I have not very big db. I am using auto increment primary keys and in my case there is no problem with that. GUID is not necessary.
I have a table containing this fields:
from_destination
to_testination
shipper
quantity
Where the fields 1,2,3 needs to be unique. Also I have second table that for the fields 1,2,3 stores bought q...
Hi all, in Firebird the only way to have an auto increment coloumn is to setup a generator and use it with a trigger.
In H2 db there are auto_increment and identity keywords to do it.
What is the best way?
Mysql use auto_increment too, but there is some problems with cuncurrence read and table lock, isn't true?
Thank you.
...
I need to copy some data from one table to another in Oracle, while generating incremental values for a numeric column in the new table. This is a once-only exercise with a trivial number of rows (100).
I have an adequate solution to this problem but I'm curious to know if there is a more elegant way.
I'm doing it with a temporary seq...
I have an XML file containing seed data that I'm trying to load into my production database.
The problem being that I have associations between different data types / nodes in the XML file, and so I need the specified IDs to be the same when loaded into MySQL from Rails.
This works fine with SQLite during development, I just use a line...
So yesterday we had a table that has an auto_increment PK for a smallint that reached its maximum. We had to alter the table on an emergency basis, which is definitely not how we like to roll.
Is there an easy way to report on how close each auto_increment field that we use is to its maximum? The best way I can think of is to do a SHO...
Hey,
If I am building a multi-shop e-commerce solution and want the orders table to maintain a shop based sequential ID, what is the best way of doing this?
For instance imagine these order IDs in sequence: -
UK0001
UK0002
UK0003
DE0001
UK0004
DE0002
etc.
through grouped PK ID MySQL / MyISAM - MySQL will manage this automatical...
A co-worker just made me aware of a very strange MySQL behavior.
Assuming you have a table with an auto_increment field and another field that is set to unique (e.g. a username-field). When trying to insert a row with a username thats already in the table the insert fails, as expected. Yet the auto_increment value is increased as can be...
I would like to have multiple users that share the same tables in the database, but have one auto_increment value per user. I will use an embedded database, JavaDB and as what I know it doesn't support this functionality. How can I implement it?
Should I implement a trigger on inserts that lookup the users last inserted row, and then ad...
Hi
I have recently started a new job and noticed that all the SQL tables use the GUID data type for the primary key.
In my previous job we used integers (Auto-Increment) for the primary key and it was a lot more easier to work with in my opinion.
For example, say you had two related tables; Product and ProductType - I could easily cro...
I have a table with an auto-incrementing ID. After inserting a new row, I would like to retrieve the new ID.
I found an article that used the MySQL function LAST_INSERT_ID(). The article says to create a new query and submit it.
I'm using MySQL Connector C++, Windows XP and Vista, and Visual Studio 9.
Here are my questions:
Is ...
Hi,
I have two mysql tables, one needs to start its auto-increment column id with the last value of the last inserted row in the other table (plus 1).
According to mysql manual you can restart the value of an auto increment column like this:
mysql> ALTER TABLE tbl AUTO_INCREMENT = 100;
However, this is not possible:
mysql> ALTER...
I have 2 tables each using other's primary key as a foreign key. The primary keys for both are set to auto_increment.
The problem is, when I try to create and entry into one of the tables, I have no idea what the primary key of the entry is and can't figure out what to put in the other table as a foreign key. What should I do? Do I drop...
Hey all
I am trying to alter a table with adding a new column setting it as auto increment and with a key.
The table already has one key and this one will be an addition. The error I get is the following.
error : Multiple primary key defined
My code is:
alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIR...
Hello folks,
I'm developing in LAMP (Linux+Apache+MySQL+PHP) since I remember myself. But one question was bugging me for years now. I hope you can help me to find an answer and point me into the right direction. Here is my challenge:
Say, we are creating a community website, where we allow our users to register. The MySQL table where ...
CakePHP 1.3.0, mysqli
I have a model, Manifest, whose ID should be the unique number from a printed form. However, with Manifest.id set as the primary key, CakePHP is helping me by setting up auto-increment on the field. Is there a way to flag the field via schema.php and/or elsewhere to disable auto-increment? I need just a plain, o...
Hey All
I have a database with around 40 tables and need to rename every index column.
IE USER a table has a bunch of fields like
user_id | user_username | user_password | etc...
I want to rename the ID columns just to id ie
id | user_username | user_password | etc...
But I keep getting mysql errors on the alter table command ie....
I can't figure out how to set AUTO_INCREMENT on a UNIQUE column using SqlAlchemy 0.6.0 with MySQL 5.
I know this can be done in MySQL, but I don't want to have to distribute extra .sql scripts in order to set up the databases for my application. I want SqlAlchemy to build the schema from within Python.
As far as I have found so far, th...