Mastering SQL with SQLZoo: A Comprehensive Guide to Solving SQL Challenges : SELECT Basic

Manoj Sharma
3 min readJun 24, 2024

--

Welcome to My in-depth guide on solving SQL challenges with SQLZoo! Whether you’re a budding data enthusiast, a seasoned developer, or just someone keen to sharpen your SQL skills, this blog is tailored for you. SQLZoo is a renowned interactive platform that offers a wide range of exercises designed to test and improve your understanding of SQL.

In this blog, I will walk you through various SQLZoo challenges, providing detailed solutions and explanations for each query. My aim is to help you grasp the nuances of SQL, from basic SELECT statements to more complex JOINs and subqueries. By following along, you will not only learn how to write efficient SQL queries but also gain insights into best practices and common pitfalls to avoid.

Here’s what you can expect:

  1. Step-by-Step Solutions: We will break down each problem, explaining the logic behind the query and the reasoning for each step.
  2. Comprehensive Explanations: Each solution will be accompanied by thorough explanations to ensure you understand the underlying concepts.
  3. Practical Tips: Along the way, we’ll share tips and tricks to help you write cleaner, more efficient SQL code.
  4. Varied Difficulty Levels: The challenges range from beginner to advanced, making this guide suitable for learners at any stage.

Join us on this journey to master SQL and become proficient in handling real-world data tasks with confidence. Let’s dive into the world of SQLZoo and start solving some exciting challenges!

0 SELECT basics

1. Introducing the world table of countries

The example uses a WHERE clause to show the population of ‘France’. Note that strings should be in ‘single quotes’;

Modify it to show the population of Germany

SELECT population FROM world
WHERE name = 'Germany'

2. Scandinavia

Checking a list The word IN allows us to check if an item is in a list. The example shows the name and population for the countries ‘Brazil’, ‘Russia’, ‘India’ and ‘China’.

Show the name and the population for ‘Sweden’, ‘Norway’ and ‘Denmark’.

SELECT name, population FROM world
WHERE name IN ('Sweden', 'Norway', 'Denmark');

3. Just the right size

Which countries are not too small and not too big? BETWEEN allows range checking (range specified is inclusive of boundary values). The example below shows countries with an area of 250,000-300,000 sq. km. Modify it to show the country and the area for countries with an area between 200,000 and 250,000.

SELECT name, area FROM world
WHERE area BETWEEN 200000 AND 250000;

Thank you for joining me in this SQL adventure! I hope you found the solutions and explanations in SELECT basics insightful and engaging. But we’re not stopping here. There’s so much more to explore and learn!

In Select From World , we will delve deeper into more complex SQL challenges on SQLZoo.
Thanks :)

--

--