Results 1 to 7 of 7
  1. #1

    Red face Making An Auto Increment As Sequence


    hello to each and everyone ..

    the table i created has no define PRIMARY KEY, INCREMENT, UNIQUE, & Constraints.

    i would like to ask our very-well knowledgeable Moderator(s) and to our guest to assist me again in my self-learning activities.

    my table has already been created. in fact, it has now some data which i was able to refine its view or contents.

    now, how can i make the column P_Id to be on its increment value ... what are the command(s) or syntax? its like it has 10-data but only numbered from 1 to 8. i didn't put or included the number 9 and 10 when i inserted new data since i want it that if add or change, i can do it in 1-single move ..

    P_Id LName FName Address City zipcode Country


    hoping to be guided accordingly.


    cheers!

  2. #2
    you can use the AUTO_INCREMENT keyword
    just google how to use it with alter table

    By the way naa pud serial datatype AKA auto increment type

  3. #3
    what database are you using?

  4. #4
    If you are using DB2 you can I think configure the column to use an auto increment. If you are using oracle, you can create a sequence, then assign the value of the sequence to the column P_Id.

    to create sequence in oracle
    Code:
       create sequence ID_SEQ increment by 1 start with 1;
    to use the sequence during insert

    Code:
     insert into table1 values(ID_SEQ.nexval,'field1','field2'....);

  5. #5
    QUESTIONS FOR TS:

    1st... unsa imong database nga gigamit?
    2nd.. asa nimo gusto e.apply ang syntax?
    front end or back end?

  6. #6

    Lightbulb how to Auto Increment a table that has already existing data

    Quote Originally Posted by moz_k2 View Post
    you can use the AUTO_INCREMENT keyword
    just google how to use it with alter table

    By the way naa pud serial datatype AKA auto increment type

    hi all

    i'm not familiar with databases but part of it says phpMyAdmin.

    likewise, i want to issue the command or apply the syntax in Run SQL query/queries on database.

    and both of it can either be its on front-end or back-end also.

    i try to google on using ALTER TABLE but seems i'm confuse of many possible answer ... any simple one.


    thanks,

    cheers!

  7. #7

    Talking adding new column in TABLE

    @ dlanyer77

    The correctness of our response to your query is likely related to the ambiguity of the content in your original post. For example, do you have existing data or what's your database?

    If you mean something else, perhaps be more specific next time bro

    hello

    sorry that some of my post looks or sounds they're inter-change. actually, as of now ... most of them are related. it just happened that when i build my dB or Table, i have no specific criteria if ever to expand it. i did just do it for practice and as it goes as i read the tutorial.

    any way, thanks really for reminding me.

    on the other hand, any idea(s) also of this another inquiries of mind [hi Moderator(s)]?


    cheers!

  8.    Advertisement

Similar Threads

 
  1. Replies: 82
    Last Post: 01-22-2011, 09:58 AM
  2. Are we prepared for an epidemic such as west nile, avian flu, SARS?
    By omad in forum Politics & Current Events
    Replies: 8
    Last Post: 02-10-2010, 08:59 AM
  3. Plz help me make an SQL Statement for this
    By DeathFox in forum Programming
    Replies: 3
    Last Post: 11-24-2007, 02:01 PM
  4. Replies: 5
    Last Post: 03-11-2007, 04:18 PM
  5. WHAT MAKES AN ENTREPRENEUR?
    By --Makoy-- in forum Business, Finance & Economics Discussions
    Replies: 23
    Last Post: 12-19-2006, 03:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top