Introduction
In the modern digital world, data is one of the most valuable resources.
Businesses, universities, hospitals, and online platforms store huge amounts of
information every day. This information must be organized, stored, and
accessed efficiently. That is where databases and SQL come in.
SQL stands for Structured Query Language. It is the standard language used
to communicate with databases. With SQL, users can create databases, store
data, update records, retrieve information, and manage data efficiently.
This tutorial introduces the fundamental concepts of SQL. It explains what SQL
is, how tables are created, how data is inserted and modified, and how queries
are written to retrieve information from a database.
What is SQL?
SQL (Structured Query Language) is a programming language used to manage
and manipulate relational databases.
A database is an organized collection of data. A relational database stores
data in the form of tables.
Each table consists of:
• Rows (records)
• Columns (fields)
For example, a student database may contain the following table:
StudentID Name Age Course
101 Ali 20 Computer Science
102 Sara 21 Business
, StudentID Name Age Course
103 Ahmed 19 Mathematics
Here:
• Each row represents a student.
• Each column represents a specific attribute of that student.
SQL allows users to interact with this data using commands.
Basic Types of SQL Commands
SQL commands are generally divided into several categories:
1. Data Definition Language (DDL)
Used to define and modify database structure.
Examples:
• CREATE
• ALTER
• DROP
2. Data Manipulation Language (DML)
Used to manipulate data stored in tables.
Examples:
• INSERT
• UPDATE
• DELETE
3. Data Query Language (DQL)
Used to retrieve data.
Example: