Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    13

    Question Unanswered: Inserting an additional column into an existing table

    Hello,

    I would like to know if it is possible to insert an additional column into an existing table.

    This is the SQL command I wrote to create a table called "Dogs":

    CREATE TABLE Dogs
    (enum number(4) NOT NULL, dname char(15), dbreed char(15), dweight number(4));

    This is the SQL command I wrote to insert rows into the table "Dogs":

    INSERT INTO Dogs
    VALUES (19, ‘Hasso’, ‘Boxer’, 30);
    INSERT INTO Dogs
    VALUES (9, ‘Lupo’, ‘Rottweiler’, 110);
    INSERT INTO Dogs
    VALUES (26, ‘Snoopy’, NULL, 2);
    INSERT INTO Dogs
    VALUES (2, ‘ShaPi’, ‘Chowchow’, 40);
    INSERT INTO Dogs
    VALUES (20, ‘Blacky’, ‘Mongrel’, 80);

    ^ Can this SQL query be condensed in any way? ^

    My question is:

    How do I insert an additional column, say "Birthday", into the table "Dogs" using a separate SQL command?

    Please kindly assist me if you can.

    Thank you very much indeed.

    Sincerely,
    c360

  2. #2
    Join Date
    Oct 2003
    Posts
    43
    alter table dogs add birthday date;

  3. #3
    Join Date
    Apr 2004
    Posts
    13
    Hello chumpski,

    Would this query make any sense if I were to add a column "Birthday" with date data type?

    ALTER TABLE Dogs
    ADD Birthday number(4);

    Thanks a lot.

    c360

  4. #4
    Join Date
    Jan 2004
    Posts
    492
    Quote Originally Posted by Centro360
    Hello chumpski,

    Would this query make any sense if I were to add a column "Birthday" with date data type?

    ALTER TABLE Dogs
    ADD Birthday number(4);

    Thanks a lot.

    c360
    Would the 4 be just a year? Since this is for dogs, maybe just a year would suffice. If you need the full date, best to use the date datatype whenever possible. Depends on what you need for your queries/reports

Posting Permissions

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