DEV Community

Jahangir-Alam-Noman
Jahangir-Alam-Noman

Posted on

CRUD OPERATION

CRUD is an acronym that stands for Create, Read, Update, and Delete.
These are the four most basic operations that can be performed with most traditional database systems and they are the backbone for interacting with any database.
Let’s get started to understand the concepts of CRUD operations in SQL Server

Create
The first letter of CRUD, 'C,' stands for CREATE, which is also known as add or insert. The SQL insert statement will be used to insert a new record in this operation. To add new records to a table, SQL uses the INSERT INTO statement.

Read
The SELECT (data retrieval) operation is represented by the second letter of CRUD, 'R.' The word ' read' refers to retrieving data or record sets from a table that has been listed (s). The data is retrieved using SQL's SELECT command. You can use SQL Server Management Studio, SQL Server Data Tools, or sqlcmd to run queries, depending on your preferences.

Update
The Update operation is represented by the third letter of CRUD, 'U.' SQL makes a change to the table's existing record(s) by using the Update keyword. You'll need to define the target table and the columns that need to be updated, as well as the associated values, when performing an update. You may also need to know which rows need to be updated. To avoid lock escalation and concurrency issues, you should keep the number of rows to a minimum.
**
Delete**
The CRUD operation ends with the letter 'D,' which refers to removing a record from a table. The DELETE command in SQL is used to delete the record(s) from the table.
When writing a DELETE statement, you'll specify the target table as well as the rows you want to remove. In its most basic form, the syntax is the DELETE keyword followed by the table name. In some cases, running a query without a WHERE clause will delete ALL existing rows from the table. Use the WHERE clause followed by the expression to add a condition clause to the SQL DELETE statement (s).

Thank you for your interest in reading this article. I hope you found it straightforward and useful.

Top comments (0)