How to create, update and delete table in sql database?

To create a new table we have to write the code below in our query editor window:

use MyDB
go
CREATE TABLE [dbo].[tbl_Employee](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](50) NULL,
[gender] [nvarchar](50) NULL,
[salary] [nvarchar](50) NULL
)

For update :

use MyDB
go

alter TABLE [dbo].[tbl_Employee](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [nvarchar](50) NULL,
[gender] [nvarchar](50) NULL,
[salary] [int] NULL
)

For delete:

drop table tbl_Employee

No comments

Powered by Blogger.