ALTER TABLE

Jack C

Total Post:13

Points:91
Posted by  Jack C
 1967  View(s)
Ratings:
Rate this:
I have a table which contains 23 columns now due to project requirement I have to add few more columns in the existing table.
Column name like newLocation, oldCityName.
If possible provide me sample of code to add columns in a table.

Thanks in advance
  1. Amit Singh

    Post:103

    Points:721
    Re: Alter Table

    we add the new column in a table by using alter command as
    alter table tablename add columnname datatype constraints


    alter table tablename add newLocation varchar(30), oldCityName varchar(20)



  1. Uttam Misra

    Post:126

    Points:906
    Re: Alter Table

    To add a column to an existing table, the ALTER TABLE syntax is:

    ALTER TABLE table_name
     ADD column_name column-definition;

    For example:

    ALTER TABLE employee
     ADD employee_name  varchar(50);

    This will add a column called employee_name to the Employee table.

  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: Alter Table


    To add a column to an existing table, the ALTER TABLE syntax is:

    ALTER TABLE table_name
     ADD column_name dataType

    For example:

    ALTER TABLE User
     ADD Name  varchar(50);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!