SQL for School Students: From SELECT to JOINs — Simple Guide

SQL is used in every company in the world. This guide takes you from your first SELECT statement to JOINs and Aggregates in plain English with Indian examples.

SQL for School Students: From SELECT to JOINs — Simple Guide

SQL is used in every company in the world. This guide takes you from your first SELECT statement to JOINs and Aggregates in plain English with Indian examples.

✓ 100% Free ✓ No Login Needed ✓ NCERT / CBSE Aligned ✓ Download as PDF

TL;DR: SQL is used in every company in the world. This guide takes you from your first SELECT statement to JOINs and Aggregates in plain English with Indian…

Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated

🤖 Stuck on any question? Ask Syllab's free AI Tutor for a step-by-step explanation — instant, unlimited, no login.

What is SQL and Why Should Students Learn It?

SQL (Structured Query Language) is the language used to talk to databases. Every website, every app, every company that stores data uses SQL (or something very similar). WhatsApp, Instagram, Swiggy, Amazon, every bank — they all use databases managed with SQL.\n\nFor students, SQL is valuable for three reasons:\n1. It is part of CBSE Class 11/12 Computer Science curriculum\n2. It is one of the most-demanded skills in every technology job\n3. It is much easier to learn than Python or Java — you can be useful in SQL within 2 weeks

The Database Concept: Tables, Rows, and Columns

A database is like a collection of spreadsheets. Each spreadsheet is called a table. Each table has rows (records) and columns (fields).\n\nExample: A school database might have a Students table:\n| StudentID | Name | Class | Marks | City |\n|-----------|------|-------|-------|------|\n| 1 | Arjun | 10 | 95 | Delhi |\n| 2 | Priya | 11 | 88 | Mumbai |\n| 3 | Rahul | 10 | 72 | Chennai |\n\nSQL lets you ask questions about this data: "Who scored more than 80?" "How many students are in Delhi?" "What is the average marks?" These are called queries.

Basic SQL Commands Every Student Must Know

SELECT — Get data:\nSELECT * FROM Students; (get all columns)\nSELECT Name, Marks FROM Students; (get specific columns)\n\nWHERE — Filter data:\nSELECT * FROM Students WHERE Marks > 80;\nSELECT * FROM Students WHERE City = 'Delhi';\n\nORDER BY — Sort data:\nSELECT * FROM Students ORDER BY Marks DESC; (highest first)\n\nINSERT — Add new data:\nINSERT INTO Students VALUES (4, 'Anjali', 12, 91, 'Hyderabad');\n\nUPDATE — Change data:\nUPDATE Students SET Marks = 96 WHERE StudentID = 1;\n\nDELETE — Remove data:\nDELETE FROM Students WHERE StudentID = 3;

Aggregate Functions: Count, Sum, Average

Aggregate functions calculate summaries across many rows:\n\nSELECT COUNT(*) FROM Students; — How many students?\nSELECT AVG(Marks) FROM Students; — Average marks of all students\nSELECT MAX(Marks) FROM Students; — Highest marks\nSELECT MIN(Marks) FROM Students; — Lowest marks\nSELECT SUM(Marks) FROM Students; — Total marks (not very useful here)\n\nWith GROUP BY:\nSELECT City, COUNT(*) FROM Students GROUP BY City;\n(Shows how many students from each city)

JOINs: Connecting Multiple Tables

Real databases have many tables that are connected. For example: a Students table and a Scores table. JOIN lets you combine data from both.\n\nINNER JOIN — Only matching records:\nSELECT Students.Name, Scores.Subject, Scores.Marks\nFROM Students\nINNER JOIN Scores ON Students.StudentID = Scores.StudentID;\n\nThis shows each student's name alongside their scores from the Scores table.\n\nJOINs are the most powerful feature of SQL. Once you understand JOINs, you can answer complex questions about any dataset.

Frequently Asked Questions

Is SQL in the CBSE Computer Science syllabus?

Yes. SQL is part of CBSE Class 11 and 12 Computer Science (Informatics Practices). Learning SQL will directly help your board exam scores.

Where can I practice SQL online for free?

SQLiteOnline.com, DB Fiddle, and W3Schools SQL Tryit are free online SQL editors. Syllab Skills Lab also has SQL practice.

Is SQL a programming language?

SQL is a query language, not a general-purpose programming language. It is designed specifically for talking to relational databases. It is easier than Python or Java to learn.