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 using SELECT queries.

    sql_select
  • Filtering Data with WHERE
    Use conditions to filter records.

    sql_where_clause
  • Sorting and Limiting Results
    Order data with ORDER BY and limit output with LIMIT.

    sql_order_limit
  • Joining Tables
    Practice inner joins, outer joins, and more.

    sql_joins
  • Aggregation and Grouping
    Use GROUP BY and aggregate functions like COUNT, SUM.

    sql_group_by

🧪 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! 🚀