---
title: "Basic operation CREATE , INSERT,  UPDATE and DELETE in SQL."  
description: "Basic operation CREATE , INSERT,  UPDATE and DELETE in SQL."  
author: "Abhishek Srivasatava"  
published: 2016-09-27  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/23077/basic-operation-create-insert-update-and-delete-in-sql  
category: "mssql server"  
tags: ["sql server"]  
reading_time: 2 minutes  

---

# Basic operation CREATE , INSERT,  UPDATE and DELETE in SQL.

## How to create table?

Table can be form by 2 ways:

Programming method and manual method.

## Programming Method

```
  Example : CREATE TABLE EE_EMPL_CAT(
PRSN_INTN_ID  int
NOT NULL PRIMARY KEY ,EMPL_STAT_CD char(20)  NOT NULL ,NAME  char(10,REFERENCE_ID int,);
```

**2nd method is the manual method. You need to follow following step.**

Under database -> under Table section right click on table point to new table.

Name the Column Name like ee_intn_id etc, datatype, check or unchecked the ‘Allow Null’ column.

\
Save the table.

For putting constraint on your table read this [Cluster and non-cluster index in SQL](https://www.mindstick.com/interview/23073/what-is-cluster-and-non-cluster-index-in-sql) and [Different types of Constraints in SQL](https://www.mindstick.com/interview/23074/what-are-the-different-types-of-constraints-in-sql).

## How to insert data into the table?

Below is the syntax to insert.

```
INSERT INTO EE_EMPL_CAT1 (PRSN_INTN_ID, [EMPL_STAT_CD],[NAME],REFERENCE_ID)    VALUES (1199667, 'ACTIVE', 'DAVID',159978)
```

## How to Update data into the table?

Below is the syntax to Update.

```
 UPDATE EE_EMPL_CAT1    SET NAME = 'SMITH'    WHERE PRSN_INTN_ID = 1199668
```

**\**

**How to delete the data from the table?**

Below is the syntax to Delete:

```
 DELETE FROM EE_EMPL_CAT1    WHERE NAME = 'DAVID'    
```

## Answers

### Answer by Abhishek Srivasatava

## How to create table?

Table can be form by 2 ways:

Programming method and manual method.

## Programming Method

```
  Example : CREATE TABLE EE_EMPL_CAT(
PRSN_INTN_ID  int
NOT NULL PRIMARY KEY ,EMPL_STAT_CD char(20)  NOT NULL ,NAME  char(10,REFERENCE_ID int,);
```

**2nd method is the manual method. You need to follow following step.**

Under database -> under Table section right click on table point to new table.

Name the Column Name like ee_intn_id etc, datatype, check or unchecked the ‘Allow Null’ column.

\
Save the table.

For putting constraint on your table read this [Cluster and non-cluster index in SQL](https://www.mindstick.com/interview/23073/what-is-cluster-and-non-cluster-index-in-sql) and [Different types of Constraints in SQL](https://www.mindstick.com/interview/23074/what-are-the-different-types-of-constraints-in-sql).

## How to insert data into the table?

Below is the syntax to insert.

```
INSERT INTO EE_EMPL_CAT1 (PRSN_INTN_ID, [EMPL_STAT_CD],[NAME],REFERENCE_ID)    VALUES (1199667, 'ACTIVE', 'DAVID',159978)
```

## How to Update data into the table?

Below is the syntax to Update.

```
 UPDATE EE_EMPL_CAT1    SET NAME = 'SMITH'    WHERE PRSN_INTN_ID = 1199668
```

**\**

**How to delete the data from the table?**

Below is the syntax to Delete:

```
 DELETE FROM EE_EMPL_CAT1    WHERE NAME = 'DAVID'    
```


---

Original Source: https://www.mindstick.com/interview/23077/basic-operation-create-insert-update-and-delete-in-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
