Teyro
CoursesFor creatorsBlog
Log inGet started
Tey Mascot
LOADING.

Every expert you admire was once a beginner who refused to quit.

Teyro

The fun way to finish learning coding and AI: short daily lessons with streaks, leagues and friends.

Get the app

Learn

  • All courses
  • Learn coding
  • Learn AI
  • Learn online
  • How it works
  • Leagues
  • Get the app

Creators

  • Teach on Teyro
  • How teaching works
  • Teach coding online
  • Teach AI online
  • Join as a Founding Creator
  • Creator log in

Resources

  • Blog
  • Features
  • Use cases
  • Compare
  • FAQ

Legal

  • Terms of Use
  • Privacy Policy

© 2026 Teyro · support@teyro.app

HomeBlogSkill Building & Careers
Skill Building & Careers

SQL Practice Questions for Beginners With Answers

Ten beginner SQL practice questions with sample tables and solutions covering SELECT, WHERE, ORDER BY, GROUP BY and JOIN. Try them before reading the answers.

The Teyro TeamOct 26, 20261 min read
On this page6 sections
  1. Sample tables
  2. Questions
  3. Answers
  4. Where Teyro fits
  5. The bottom line
  6. More guides

You learn SQL by writing it. Try these before you read the answers.

Sample tables

customers(id, name, city)
orders(id, customer_id, total, created_at)

Questions

  1. List all customers.
  2. List customers from "Lagos".
  3. List the 5 largest orders.
  4. Count how many orders exist.
  5. Show total revenue.
  6. Show revenue per customer.
  7. Show customers with more than 3 orders.
  8. List customers with their order totals.
  9. Find customers who have no orders.
  10. Find the average order total.

Answers

-- 1
SELECT * FROM customers;
-- 2
SELECT * FROM customers WHERE city = 'Lagos';
-- 3
SELECT * FROM orders ORDER BY total DESC LIMIT 5;
-- 4
SELECT COUNT(*) FROM orders;
-- 5
SELECT SUM(total) FROM orders;
-- 6
SELECT customer_id, SUM(total) FROM orders GROUP BY customer_id;
-- 7
SELECT customer_id FROM orders GROUP BY customer_id HAVING COUNT(*) > 3;
-- 8
SELECT c.name, o.total FROM customers c JOIN orders o ON o.customer_id = c.id;
-- 9
SELECT c.name FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.id IS NULL;
-- 10
SELECT AVG(total) FROM orders;

Where Teyro fits

Teyro's SQL and Databases for Beginners course turns this into short lessons you can play in a few minutes a day. It has 50 lessons, and you can start free.

The bottom line

Type the queries yourself, change them and see what happens.

More guides

  • SQL SELECT Statement
  • SQL WHERE Clause
  • INNER JOIN vs LEFT JOIN
  • Sql practice for beginners
  • How to learn sql for beginners
  • SQL and Databases for Beginners course

Frequently asked questions

How can I practise SQL?

Use sample databases and exercises, write queries yourself and check your results against expected output.

Do I need to install a database?

Not necessarily. Many tools run SQL in the browser, and SQLite is simple to install.

How often should I practise?

Little and often. Short daily sessions work well.

Learn it by playing

SQL and Databases for Beginners turns this into short, playable lessons. Free to start.

See the SQL and Databases for Beginners course

Free to start · No credit card needed

Share

Written by

The Teyro Team

Learning Team at Teyro

We build Teyro — an AI-powered learning platform that turns skill-building into a daily habit through bite-sized, gamified lessons. We write about the learning science and study strategies that shape our product.

More from The Teyro Team

On this page

  • Sample tables
  • Questions
  • Answers
  • Where Teyro fits
  • The bottom line
  • More guides

Keep reading

Skill Building & Careers

Best Careers for 2027: High-Demand Jobs and the Skills to Get Them

The best careers for 2027 and the jobs most in demand, based on BLS and World Economic Forum data, plus the skills each path needs.

Oct 30, 20263 min read
Skill Building & Careers

Best Certifications for 2027: Tech, Data, Cloud and Business

The best certifications for 2027 in cloud, security, data, project management and AI, who each one suits, and when a portfolio matters more.

Oct 30, 20263 min read
Skill Building & Careers

Best Programming Language to Learn in 2027 (for Your Goal)

The best programming language to learn in 2027 depends on what you want to build. Compare Python, JavaScript, TypeScript, SQL and C.

Oct 30, 20263 min read