logo

Oracle NextGen

score

SQL Challenges

Practice your SQL skills with our collection of challenges

Filter by difficulty:
Challenge #1 – Select All Products
Retrieve all products from the products table. This is a basic SELECT query to get familiar with querying data.
Challenge #2 – Count Employees
Count the total number of employees in the company.
Challenge #3 – Filter by Price
Find all products that cost less than $100.
Challenge #4 – Find Specific Customer
Retrieve customer information for customers whose email ends with '@gmail.com'.
Challenge #5 – Average Salary by Department
Calculate the average salary for each department.
Challenge #6 – Top Scoring Students
Report the students who scored 90 or above in the most recent algorithm exam. Provide their identifiers, names, and scores ranked from highest to lowest.
Challenge #7 – Customer Orders Summary
Find customers who have placed more than 2 orders and show their total spending.
Challenge #8 – Product Categories Revenue
Calculate total revenue for each product category and show only categories with revenue over $500.
Challenge #9 – Employee Managers
List all employees along with their manager's name. Show employees who have a manager.
Challenge #10 – Monthly Sales Trend
Calculate total sales for each month in 2024 and show the month name and total.
Challenge #11 – Consecutive Login Streak
Find users who have logged in for at least 3 consecutive days and show their longest streak.
Challenge #12 – Second Highest Salary
Find the second highest salary in each department. If a department has only one employee, return NULL.
Challenge #13 – Customer Retention Rate
Calculate the month-over-month retention rate: the percentage of customers who made purchases in both the current and previous month.
Challenge #14 – Product Recommendation Pairs
Find pairs of products that are frequently bought together (in the same order). Show pairs that appear in at least 2 orders.
Challenge #15 – Running Total with Reset
Calculate a running total of daily sales for each product category, but reset the total when it exceeds $1000.