1.

How will you add a new column to an existing table in SQL?

Answer»

With the HELP of ALTER Command, we can add columns to an existing table. This command allows you to drop a COLUMN also. The query that can be used to add a column into the existing ONE is-

ALTER TABLE dbo.StudentRcords ADD hobbies VARCHAR(50) NULL;

NOTE- You have to make the hobbies column NOT NULL or have to give a default value to it, otherwise the above query won’t work.



Discussion

No Comment Found