SQL – Alter (Modify Existing Object)

Spread the love

SQL – ALTER – modification in existing object like Table , Views , Stored Procedures , Functions etc.

Syntax –

Alter Table’s Columns add/drop

Alter Table TableName
Add/Drop ColumnName

 

Brand Table

S.NOPRODUCTMONTHYEARQTYSALES
1NIKEDEC2016107599
2REEBOKJAN2014181200
3FILAFEB201786000
4PUMAJAN2015165000
5REEBOKFEB2016209544
6FILAMAR201566252

 

Alter table Brand

 

Alter Table

Brand Table

S.NOPRODUCTMONTHYEARQTYSALES
1NIKEDEC2016107599
2REEBOKJAN2014181200
3FILAFEB201786000
4PUMAJAN2015165000
5REEBOKFEB2016209544
6FILAMAR201566252

 

ALTER TABLE BRAND
ADD PRODUCT_CODE CHAR(5)

Brand Table

S.NOPRODUCTMONTHYEARQTYSALESPRODUCT_CODE
1NIKEDEC2016107599NULL
2REEBOKJAN2014181200NULL
3FILAFEB201786000NULL
4PUMAJAN2015165000NULL
5REEBOKFEB2016209544NULL
6FILAMAR201566252NULL