28-07-2025
Introduction to SQL (Structured
Query Language)
Basics of Database Interaction
Presented by: Dr. Yatendra Sahu
What is SQL?
• SQL stands for Structured Query Language.
• Standard language for accessing and
manipulating relational databases.
• Developed by IBM in the 1970s; later
standardized by ANSI and ISO.
• Used to query, insert, update, delete data and
define schemas.
1
28-07-2025
Why Learn SQL?
• Universal skill for working with data.
• Used across industries like tech, finance,
healthcare, etc.
• Integrates with tools like Python, Java, Excel,
R, etc.
• Essential for data analysis, backend
development, and database administration.
SQL Database Concepts
• Database: A structured collection of related data.
• Table: A collection of related data in rows and
columns.
• Row (Record): A single entry in a table.
• Column (Field): A data attribute.
• Primary Key: Uniquely identifies each row.
• Foreign Key: Links one table to another.
2
28-07-2025
Types of SQL Commands
• DDL (Data Definition Language) - CREATE, ALTER,
DROP
• DML (Data Manipulation Language) - INSERT,
UPDATE, DELETE
• DQL (Data Query Language) - SELECT
• DCL (Data Control Language) - GRANT, REVOKE
• TCL (Transaction Control Language) - COMMIT,
ROLLBACK
Basic SQL Syntax
StudentID Name Age Course
101 Alice 20 [Link] CSE
102 Rose 22 [Link] IT
• SELECT column1, column2
FROM table_name
WHERE condition;
• Example: SELECT name, age FROM Students
WHERE age > 18;
Name Age
Alice 20
Rose 22
3
28-07-2025
Creating a Table (DDL)
• CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Course VARCHAR(50)
);
StudentID Name Age Course
Inserting Data (DML)
• INSERT INTO Students (StudentID, Name, Age,
Course) VALUES (101, 'Alice', 20, '[Link] CSE');
• INSERT INTO Students (StudentID, Name, Age,
Course) VALUES (102, ‘Rose', 22, '[Link] IT’);
StudentID Name Age Course
101 Alice 20 [Link] CSE
102 Rose 22 [Link] IT
4
28-07-2025
Querying Data (DQL)
• SELECT * FROM Students;
StudentID Name Age Course
101 Alice 20 [Link] CSE
102 Rose 22 [Link] IT
• SELECT Name, Age FROM Students WHERE
Age > 18;
Name Age
Alice 20
Rose 22
Updating and Deleting
• UPDATE Students SET Age = 21 WHERE
StudentID = 101;
StudentID Name Age Course
101 Alice 20 21 [Link] CSE
102 Rose 22 [Link] IT
• DELETE FROM Students WHERE StudentID =
102;
StudentID Name Age Course
101 Alice 20 21 [Link] CSE
5
28-07-2025
Summary
• SQL is essential for working with relational
databases.
• Key operations include: SELECT, INSERT,
UPDATE, DELETE.
• Understanding joins, keys, and constraints is
crucial.
• Practice with real-world datasets to gain
proficiency.
Tools to Practice SQL
• MySQL
• PostgreSQL
• SQLite
• SQL Server
• Online Platforms: SQLFiddle, W3Schools,
HackerRank, LeetCode
6
28-07-2025
Q&A
• Any questions?
• Let’s discuss your doubts.