CRUD OPERATION IN SQL

LEELA S
2 min readMar 8, 2022

CRUD stands for CREATE, READ, UPDATE, and DELETE. In SQL Server, CRUD is represented by 4 operations performed on the selected data against a specific SQL database:

  • CREATE refers to inserting columns and values into the table
  • READ refers to retrieving data from the table
  • UPDATE refers to modifying data in the table
  • DELETE refers to deleting data and records in the table
  1. CREATE
  • In CRUD operations, C for create which means to add or insert data into the SQL table. So, firstly we will create a table using CREATE command and then we will use the INSERT INTO command to insert rows in the created table

Syntax:

  • CREATE TABLE Table_Name (ColumnName1 Datatype, ColumnName2 Datatype,…, ColumnNameN Datatype);

2)READ

  • In CRUD operations, R is for read which means retrieving or fetching the data from the SQL table. So, we will use the SELECT command to fetch the inserted records from the SQL table.
  • We can retrieve all the records from a table using an asterisk (*) in a SELECT query. There is also an option of retrieving only those records which satisfy a particular condition by using the WHERE clause in a SELECT query

Syntax

  • SELECT *FROM TableName;
  • SELECT *FROM TableName WHERE CONDITION;

3)UPDATE

  • U stands for the update, which means making updates to the records present in the SQL tables. So, we will use the UPDATE command to make changes in the data present in tables.

Syntax

  • UPDATE Table_Name SET ColumnName = Value WHERE CONDITION;

4)DELETE

  • D is for delete, which means removing or deleting the records from the SQL tables. We can delete all the rows from the SQL tables using the DELETE query.

Syntax

  • DELETE FROM TableName;

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

LEELA S
LEELA S

No responses yet

Write a response