Skip links
Learn SQL in 10 Minutes | SELECT, INSERT, UPDATE, DELETE

Learn SQL in 10 Minutes | SELECT, INSERT, UPDATE, DELETE

If you’re just starting with databases, these four commands will take you a long way: SELECT, INSERT INTO, UPDATE, and DELETE.

In this quick Episode 4 of the Database Series, you’ll learn:

  • What each command does
  • How to use it with a sample table
  • Real-world examples that make it easy to follow

Let’s jump in!

 Sample Table: students

We’ll use a simple table named students for all examples.

id name course marks
1 Ayesha Math 85
2 Ali Physics 78
3 Sara English 92

 1. SELECT – Read Data from a Table

What it does:
Retrieves data from one or more columns in a table.

Syntax:

SELECT column1, column2 FROM table_name;

Example – Show all students:

SELECT * FROM students;

Example – Show only names and marks:

SELECT name, marks FROM students;

Use WHERE to filter results:

SELECT * FROM students WHERE marks > 80;

 2. INSERT INTO – Add New Data

What it does:
Adds a new row (record) to the table.

Syntax:

INSERT INTO table_name (column1, column2, …)

VALUES (value1, value2, …);

Example – Add a new student:

INSERT INTO students (id, name, course, marks)

VALUES (4, ‘Zara’, ‘Biology’, 88);

After this command, Zara’s data will be added as a new row.

 3. UPDATE – Modify Existing Data

What it does:
Changes the value of one or more fields in existing rows.

Syntax:

UPDATE table_name

SET column1 = value1

WHERE condition;

Example – Change Ali’s marks:

UPDATE students

SET marks = 82

WHERE name = ‘Ali’;

Always use a WHERE clause to avoid updating all records!

 4. DELETE – Remove Data from the Table

What it does:
Removes one or more rows from the table.

Syntax:

DELETE FROM table_name

WHERE condition;

Example – Delete student with ID 2:

DELETE FROM students

WHERE id = 2;

Without WHERE, this would delete all rows in the table!

 Quick Summary of SQL CRUD Commands

Command Action Use Case Example
SELECT Read View student names and marks
INSERT Create Add a new student to the database
UPDATE Modify Change a student’s score
DELETE Remove Delete a student’s record

 Real-World Usage

These commands are used daily in:

  • Web apps to manage users
  • Data dashboards to show reports
  • Admin panels to update content
  • Back-end systems for inventory, sales, records

Related: SQL Basics for Beginners | What is SQL and How It Works

 

Leave a comment