Welcome to the SQL Exercises page! Here, you'll find a collection of practical tasks to enhance your SQL proficiency. Whether you're a beginner or looking to refine your skills, these exercises will help you master querying and managing databases.
📚 Exercise Topics
Basic SELECT Statements
Retrieve data from tables usingSELECT
queries.Filtering Data with WHERE
Use conditions to filter records.Sorting and Limiting Results
Order data withORDER BY
and limit output withLIMIT
.Joining Tables
Practice inner joins, outer joins, and more.Aggregation and Grouping
UseGROUP BY
and aggregate functions likeCOUNT
,SUM
.
🧪 Sample Query Exercise
Write a query to list all customers from the northwind
database who have placed orders in the last 30 days.
Hint: Use JOIN
between Customers
and Orders
tables.
Click to see the solution
```sql SELECT Customers.CustomerName FROM Customers JOIN Orders ON Customers.CustomerID = Orders.CustomerID WHERE Orders.OrderDate >= DATE_SUB(CURDATE(), INTERVAL 30 DAY); ```🔄 Expand Your Knowledge
Need more practice? Explore our SQL Tutorial for foundational concepts or dive into advanced topics like SQL Subqueries. Happy coding! 🚀