Insert and delete instructions on SQL Server

 Today we intend to familiarize you with Insert and Delete on SQL server.

Sql server commands

You know that the database is purely for storing data on the server and in order to be able to store and then manage the data you need commands like insert, delete and so on. You can manage In future sessions you will learn more from the SQL server

Insert command in SQL server

The insert in the SQL server is simply used to insert a record into a table. Each database has multiple tables created by the database designer, making each table an entity.

Imagine a hospital, for example, suppose you were asked to create a database for the hospital. The entities located in a hospital should be identified by you.

Like doctors, patients, nurses, users, beds, rooms, floors, etc., they are all one entity and can create a table in the database for us.

To an entity that should be a conceptual database designer means that it can create valuable value for us. Or, to put it another way, an entity that is capable of storing its data in a database and whose data is of high value.

For example, physician and patient entities are one of the most important entities that can create valuable data in a database system.

But a chair in the hospital hall called an entity does not give us data and we simply have to ignore that entity.

What is a table

Each table in the database has fields identified by us that each field is placed in a column, for example, the fields of a physician can be identified by ID, name and family name, specialty, degree, age, etc. Say

 

It is quite clear in the picture above that there is a field in each column, and all the fields form a row, which is called a record, so we’ll go over that record

Insert command structure in SQL Server

The structure of the Insert statement is as follows

Field name data type It can be empty main switch
UserID int No Yes
UserName navarchar No No
Password navarchar No No
Name navarchar No No
Family navarchar No No

Now if we want to insert a record in this table we must use the Insert command. As follows:

 

Delete command in sqlserver

Now that you are familiar with the insert command in the sql server, we are going to teach delete

Example: We want to delete the same record from the database. You should use the following command

Related posts