Kaggle Intro to SQL Exercise 3 Easy Guide to Mastering JOINs AND Querying

Robert Jul 13, 2026

Embarking on your SQL learning journey with Kaggle's 'Introduction to SQL' exercise series? You're excelling with 'Exercise 3'! This interactive session dives you into managing complex queries and manipulating data using the powerful Structured Query Language (SQL).

Sql Cheat Sheet, Learn Sql, Learn Web Development, Excel Tutorials, Sql Server, Career Options, Data Analyst, Data Scientist, Data Analysis
Sql Cheat Sheet, Learn Sql, Learn Web Development, Excel Tutorials, Sql Server, Career Options, Data Analyst, Data Scientist, Data Analysis

Priorেহave some SQL basics up your sleeve, feel confident to tie it all together in this exercise. By now, you should be comfortable with SELECT, WHERE, AND, OR, NOT, and some basic data types. If you're unsure, revisit previous exercises to strengthen your foundation.

Learn SQL Fast πŸš€ | Beginner SQL Commands Cheat Sheet for Data Analysts
Learn SQL Fast πŸš€ | Beginner SQL Commands Cheat Sheet for Data Analysts

Complex Queries and Subqueries

'Exercise 3' introduces you to complex queries and subqueries, allowing you to probe deeper into data. Prepare to get comfortable with the ')' and '(' parentheses!

Learn SQL just by investing 30 minutes a day within 30 Days
Learn SQL just by investing 30 minutes a day within 30 Days

A subquery is a query nested inside another query. It executes before the main query, with its results used to filter records. Sounds intricate? Let's break it down.

Correlated Subqueries

7 SQL Projects for Beginners | Build a Real Data Portfolio
7 SQL Projects for Beginners | Build a Real Data Portfolio

Correlated subqueries rely on values from the outer query to determine their results. These subqueries use a keyword FIRST, LAST, ALL, or ANY with an operator (=, <>, <, >, <=, >=, between, in, like, or not in).

Imagine you're managing a retail store. You need to find products where the quantity is greater than the average quantity of products in the same category. A correlated subquery can retrieve this data by comparing each product with the average:

Non-Correlated Subqueries

CQF - SQL
CQF - SQL

Non-correlated subqueries don't rely on values from the outer query. Instead, they use constants or columns from the same table. These subqueries are 'self-contained', using the keywords FIRST, LAST, ALL, or ANY with a specific comparison operator as mentioned earlier.

Suppose you're maintaining a customer database and want to find out how many customers are older than the oldest customer in your database. A non-correlated subquery can yield this result by comparing each customer's age with a constant:

Data Manipulation

SQL HAVING CLAUSE explained for beginners
SQL HAVING CLAUSE explained for beginners

'Exercise 3' isn't just about querying; it also delves into data manipulation using INSERT, UPDATE, and DELETE statements.

Here you'll practice amending data in your tables to match the current scenario. Let's say you've updated your product prices due to inflation. You can use an UPDATE statement to reflect these changes in your database:

SQL CASE WHEN Explained with Examples | Beginner SQL Tutorial
SQL CASE WHEN Explained with Examples | Beginner SQL Tutorial
Top SQL Queries Every Fresher Should Practice
Top SQL Queries Every Fresher Should Practice
SQL Joins Explained with Examples | Complete JOIN Cheat Sheet for Beginners
SQL Joins Explained with Examples | Complete JOIN Cheat Sheet for Beginners
SQL Query Execution Order Explained | Logical Order of SQL Query Processing
SQL Query Execution Order Explained | Logical Order of SQL Query Processing
SQL Basics Cheat Sheet for Beginners | Learn SQL Fast πŸ’»
SQL Basics Cheat Sheet for Beginners | Learn SQL Fast πŸ’»
SQL Joins Explained πŸš€ | Beginner Data Analyst SQL Guide
SQL Joins Explained πŸš€ | Beginner Data Analyst SQL Guide
7 SQL QUERIES EVERY STUDENT SHOULD MASTER
7 SQL QUERIES EVERY STUDENT SHOULD MASTER
SQL Cheatsheet In 2026 πŸš€
SQL Cheatsheet In 2026 πŸš€
Top 20 SQL Queries for Practice | SQL Cheat Sheet for Beginners & Interviews
Top 20 SQL Queries for Practice | SQL Cheat Sheet for Beginners & Interviews
SQL Basics For Beginners
SQL Basics For Beginners
SQL FULL OUTER JOIN Explained with Examples | Beginner SQL Tutorial
SQL FULL OUTER JOIN Explained with Examples | Beginner SQL Tutorial
SQL CTE Explained with Examples | Common Table Expression Tutorial
SQL CTE Explained with Examples | Common Table Expression Tutorial
SQL LAG() Explained with Examples | Beginner SQL Window Function Tutorial
SQL LAG() Explained with Examples | Beginner SQL Window Function Tutorial
SQL Joins Explained with Examples | Beginner SQL Guide
SQL Joins Explained with Examples | Beginner SQL Guide
SQL NULLIF() Explained with Examples | Prevent Divide by Zero Errors in SQL
SQL NULLIF() Explained with Examples | Prevent Divide by Zero Errors in SQL
SQL queries don
SQL queries don
SQL Basics Tutorial for Beginners – Structured Query Language Commands, Syntax & Examples Guide
SQL Basics Tutorial for Beginners – Structured Query Language Commands, Syntax & Examples Guide
SQL
SQL
SQL Aggregate Functions Cheat Sheet for Beginners
SQL Aggregate Functions Cheat Sheet for Beginners

INSERT Statement

The INSERT statement adds new records into a table. You can add one record at a time or multiple records using a VALUES clause.

Suppose you're launching a new product line in your store. To add these products to your inventory, you can use the INSERT statement:

DELETE Statement

The DELETE statement removes existing records from a table. Be cautious when using this statement, as deleted records can't be retrieved.

Fallible humans make mistakes, and sometimes, data discrepancies occur in your database. A DELETE statement can remove such erroneous entries:

As you conclude 'Exercise 3', you're now capable of crafting complex queries and manipulating data using SQL. The best part? This is just the beginning! Continuously practice, and you'll be an SQL maestro in no time. So, what's next on your SQL learning adventure?