Alter Table

Total Post:13

Points:91
 2241  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. 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. Post:127

    Points:915
    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.

      Modified On Apr-11-2018 10:25:24 PM
  1. Post:280

    Points:1994
    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);

      Modified On Apr-11-2018 10:25:44 PM

Answer

NEWSLETTER

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