×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    11

    How to increase a column by 1 in database.

    I have create a table using "CREATE TABLE temp (id integer, title varchar). And insert values. Now i want to increase column "id". How to write the statements? I wrote like this "UPDATE temp set id=id+1". Why this didn't work?

  2. #2
    Registered User
    Join Date
    Dec 2009
    Posts
    7

    Re: How to increase a column by 1 in database.

    Hi.
    You need to know how work a database^^

    Make a new table with : "CREATE TABLE `temp` (`id` INT NOT NULL AUTO_INCREMENT ,`Title` TEXT NOT NULL ,PRIMARY KEY ( `id` ))

    This will make a new table with ID in auto_increment.Then next time when you add a data it will increase automatically.
    Ex.
    INSERT INTO `temp` (`id` ,`Title`)VALUES (NULL , 'test');

    ID will be ID+1 with NULL params.

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    11

    Re: How to increase a column by 1 in database.

    ixiodor:
    thanks, but you may misunderstanding me because of my poor english. The auto_increment is useful, but it's not what I want. I just want to know how to modify the data which is already there. For example, double them all or add 5.
    thank you.


    Quote Originally Posted by ixiodor View Post
    Hi.
    You need to know how work a database^^

    Make a new table with : "CREATE TABLE `temp` (`id` INT NOT NULL AUTO_INCREMENT ,`Title` TEXT NOT NULL ,PRIMARY KEY ( `id` ))

    This will make a new table with ID in auto_increment.Then next time when you add a data it will increase automatically.
    Ex.
    INSERT INTO `temp` (`id` ,`Title`)VALUES (NULL , 'test');

    ID will be ID+1 with NULL params.

Similar Threads

  1. Application Closed! KERN-EXEC 0
    By smnsolomon in forum Symbian
    Replies: 3
    Last Post: 2008-04-20, 15:36
  2. Replies: 4
    Last Post: 2007-03-09, 09:03
  3. database trouble
    By liafail in forum Symbian
    Replies: 6
    Last Post: 2005-12-28, 05:56
  4. Replies: 2
    Last Post: 2004-08-14, 06:22
  5. database problem
    By sridhar_ratna in forum Symbian
    Replies: 1
    Last Post: 2003-04-18, 09:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×