DEV Community

Cover image for 10 Captivating SQL Challenges to Sharpen Your Database Skills πŸš€
Labby for LabEx

Posted on

10 Captivating SQL Challenges to Sharpen Your Database Skills πŸš€

Are you an aspiring SQL enthusiast looking to take your database management skills to the next level? Look no further! LabEx, a leading platform for hands-on programming challenges, has curated a collection of 10 captivating SQL challenges that will push your abilities to new heights.

MindMap

From creating and updating database views to analyzing student course data and calculating salary ranges, this lineup of challenges covers a wide range of SQL concepts and techniques. Whether you're a beginner or an experienced SQL practitioner, these exercises will help you hone your skills, deepen your understanding of database management, and prepare you for real-world scenarios.

1. Creating and Updating Database Views (Challenge) πŸ—„οΈ

In this challenge, you'll learn how to create a view in MySQL and update the data within that view. You'll start by importing data into MySQL and then use the student table as the base to create a student_view table. Finally, you'll update the name field in the student_view view with the value 'Physics' for a specific entry. Explore this challenge.

2. Columbus Discovery of the New World (Challenge) 🌍

This challenge focuses on working with SQL statements in the MySQL client to convert a date string to a date type object and print it. You'll practice using the STR_TO_DATE function in SQL and gain a deeper understanding of assigning aliases with the AS keyword. Dive into this challenge.

3. MySQL Database Management Fundamentals (Challenge) πŸ—ƒοΈ

In this challenge, you'll be performing DDL-related operations on a database. You'll need to create tables, modify their structures, and perform actions like deleting data and dropping tables. The goal is to test your knowledge and skills in using DDL statements such as CREATE, ALTER, DELETE, TRUNCATE, and DROP. Explore this challenge.

4. Delete Expired Course Information (Challenge) πŸ—‘οΈ

This challenge requires you to write a script to delete expired course information from a database. You'll use the DELETE statement to remove a specific course based on its course ID. The script must be saved in a file named deleteCourse.sql in the specified directory, and you'll run it in MySQL for verification. Dive into this challenge.

5. Average Salaries Per Department (Challenge) πŸ“Š

In this challenge, you'll be working with a university database and your task is to write a script that prints the average salary of each department in descending order. You'll need to import the database, group the salary data by department, and calculate the average salary using the AVG() function. The result should display the department name and the corresponding average salary. Explore this challenge.

6. Course Schedule CRUD With MyBatis (Challenge) πŸ“…

This challenge involves working with the MyBatis framework to create a course schedule and perform CRUD operations on it. You'll get hands-on experience with this popular SQL mapper tool. Dive into this challenge.

7. SQL Queries for Student Course Analysis (Challenge) πŸŽ“

In this challenge, you'll be working with a student course database. The goal is to write MySQL statements that accomplish various requirements, such as listing the names of students who have not taken courses taught by a specific teacher, identifying students who have failed multiple courses, and finding students who have taken specific courses. This challenge focuses on improving your MySQL query skills and database manipulation techniques. Explore this challenge.

8. Practical Use of resultMap (Challenge) πŸ—ΊοΈ

This challenge will have you using resultMap to specify the mapping between fields and entity class properties. This will help you resolve the issue of inconsistent naming between the fields and entity class properties. Dive into this challenge.

9. Salary Range for Teachers by Department (Challenge) πŸ’°

In this challenge, you'll be using MySQL built-in functions to query the maximum and minimum salary of teachers in each department of a university. You'll import the data from a provided script and write a script to perform the queries. The results should include the department name, maximum salary, and minimum salary for each department. Explore this challenge.

10. Query GDP for All Countries 🌎

In this challenge, you'll retrieve the GDP for all countries by querying the world database in MySQL. The country name and GDP attributes can be obtained from the country table using a script. The resulting query will provide 239 rows of information. Dive into this challenge.

Dive into these captivating SQL challenges and elevate your database management skills to new heights! πŸ’ͺ Each exercise is designed to push your boundaries and help you become a more proficient SQL practitioner. Good luck, and happy coding! πŸš€


Want to Learn More?

Top comments (0)