SELECT
WHERE
ORDER BY
COUNT & GROUP BY
SQL Vocabulary
100

What does the SELECT statement do?

Retrieves data from a database.

100

What does the WHERE clause do?

Filters records based on a condition.

100

What does ORDER BY do?

Sorts the results.

100

What does COUNT(*) return?

The total number of rows.

100

What is a database?

A collection of organized data.

200

Write a query to select all columns from a table called Students.

SELECT * FROM Students;

200

Select all students who are 13 years old.

SELECT * FROM Students
WHERE Age = 13;

200

Sort students by age from smallest to largest.


SELECT * FROM Students
ORDER BY Age ASC;


200

Count how many students are in the table.

SELECT COUNT(*) FROM Students;

200

What is a table?

A collection of rows and columns that stores data.

300

Select only the FirstName column from the Students table.

SELECT FirstName FROM Students;

300

Select students whose name is "Maria".

SELECT * FROM Students
WHERE FirstName = 'Maria';

300

Sort students by age from largest to smallest.

SELECT * FROM Students
ORDER BY Age DESC;

300

Count how many students are 13 years old.

SELECT COUNT(*) FROM Students
WHERE Age = 13;


300

What is a column?

A field that stores one type of data.

400

Select the FirstName and Age columns from the Students table.

SELECT FirstName, Age FROM Students;

400

Select students older than 12.

SELECT * FROM Students
WHERE Age > 12;

400

Sort students alphabetically by last name.

SELECT * FROM Students
ORDER BY LastName ASC;

400

Count how many students are in each age group.

SELECT Age, COUNT(*)
FROM Students
GROUP BY Age;


400

What is a row?

A single record in a table.

500

Select all students but rename the FirstName column as Name.


SELECT FirstName AS Name FROM Students;

500

Select students who are 12 or 13 years old.

SELECT * FROM Students
WHERE Age = 12 OR Age = 13;

500

Sort students by age (oldest first), and if two students are the same age, sort them by first name.

SELECT * FROM Students
ORDER BY Age DESC, FirstName ASC;

500

Count how many students are in each age group and sort by age.

SELECT Age, COUNT(*)
FROM Students
GROUP BY Age
ORDER BY Age;


500

What does the asterisk * mean in SQL?

It selects all columns.

M
e
n
u