Curriculum
Course: Grade XI Informatics Practices
Login
Text lesson

Ch7-SQL-Querying-Data

School Revise · Class 11 Informatics Practices · Chapter 7

SQL Querying Data

Code 065, Class 11. Querying asks questions of the data in a table. Here we select, filter, sort and summarise rows with SQL.

SELECT

reads data

WHERE

filters rows

What this chapter is about

SELECT reads data from a table. A WHERE clause filters rows, ORDER BY sorts them, and DISTINCT removes repeats.

1. Selecting and filtering

SELECT * FROM STUDENT shows every column; naming columns shows only those. WHERE keeps only the rows that match a condition.

SELECT name FROM STUDENT WHERE marks > 80; (shows names of students who scored above 80)

2. Sorting and distinct

ORDER BY column sorts the result (ASC or DESC). DISTINCT lists each value once.

3. Summarising

Aggregate functions summarise: COUNT, SUM, AVG, MAX, MIN. GROUP BY makes one summary per group.

Practise with the interactive

Explore the idea by tapping. The interactive opens right here in the lesson.

Coding practice problems, with answers

Type each one into the code lab above, then open the card to see the worked solution and its output.

Problem 1. Show all rows.

SOLUTION

SELECT * FROM STUDENT;

OUTPUT

all rows and columns
Problem 2. Show only the names.

SOLUTION

SELECT name FROM STUDENT;

OUTPUT

the name column
Problem 3. Show students who scored above 80.

SOLUTION

SELECT name FROM STUDENT WHERE marks > 80;

OUTPUT

names with marks above 80
Problem 4. Sort by marks, highest first.

SOLUTION

SELECT * FROM STUDENT ORDER BY marks DESC;

OUTPUT

rows sorted by marks, largest first
Problem 5. List each city once.

SOLUTION

SELECT DISTINCT city FROM STUDENT;

OUTPUT

each city listed once
Problem 6. Count the students.

SOLUTION

SELECT COUNT(*) FROM STUDENT;

OUTPUT

the number of rows
Problem 7. Find the average marks.

SOLUTION

SELECT AVG(marks) FROM STUDENT;

OUTPUT

the average of marks
Problem 8. Find the highest marks.

SOLUTION

SELECT MAX(marks) FROM STUDENT;

OUTPUT

the largest marks
Problem 9. Show marks between 40 and 80.

SOLUTION

SELECT name FROM STUDENT WHERE marks BETWEEN 40 AND 80;

OUTPUT

names with marks in that range
Problem 10. Count students per city.

SOLUTION

SELECT city, COUNT(*) FROM STUDENT GROUP BY city;

OUTPUT

one row per city with its count

Practice set A, multiple choice

1. Which command reads data?

SELECT.

2. Which clause filters rows?

WHERE.

3. Which clause sorts the result?

ORDER BY.

4. Which removes repeated values?

DISTINCT.

Quick summary

SELECT reads data; naming columns limits what is shown. WHERE filters rows, ORDER BY sorts (ASC or DESC) and DISTINCT lists each value once. Aggregate functions COUNT, SUM, AVG, MAX and MIN summarise data, and GROUP BY makes one summary per group.

Open the Virtual Lab

These free Class 11 Informatics Practices notes explain SQL querying, SELECT with WHERE and ORDER BY, DISTINCT, aggregate functions and GROUP BY with worked examples and practice, for CBSE students across India and the Gulf including the UAE, Saudi Arabia, Qatar, Oman, Kuwait and Bahrain.

© 2026 School Revise. All rights reserved. Original content aligned to the CBSE and NCERT Class 11 Informatics Practices syllabus. Unauthorised copying is not permitted.

Layer 1
Login Categories