1.
Create a Table
CREATE TABLE STUDENT
(
Id int Identity(1,1),
Name varchar(10)
)
2. Insert a Row
INSERT INTO STUDENT VALUES('XYZ')
3. Show Data
SELECT * FROM STUDENT
4.
Add a New Column
ALTER TABLE STUDENT
ADD Address VARCHAR(50)
SELECT * FROM STUDENT
5.
Modify Column Type
Here I am going to Modify Address Column
from VARCHAR(50) to NVARCHAR(50)
ALTER TABLE STUDENT
ALTER COLUMN Address NVARCHAR(50)
6.
Rename a Column
sp_rename 'STUDENT.Address','Stu_Address','COLUMN'
SELECT * FROM STUDENT
7.
Drop a Column
ALTER TABLE STUDENT
DROP COLUMN
Stu_Address