JavaScript is required to use this application. Please enable JavaScript in your browser settings or disable any extensions that may be blocking scripts.
Practice real SQL interview problems. Write queries, get AI feedback.
Write a SQL query to find the second highest salary from the `employees` table. If there is no second highest, return NULL.
For each department, find the top 3 highest-paid employees. Return department, employee name, and salary ordered by department and salary descending.
Calculate the running total of daily revenue ordered by date. Return date, daily_revenue, and running_total.
Given a table of sequential log IDs, find all the missing IDs (gaps) in the sequence. Return start_gap and end_gap for each range of missing IDs.
Transform rows of monthly sales data into columns. Output: product_name, jan_sales, feb_sales, mar_sales using conditional aggregation.
Find all users who logged in for 3 or more consecutive days. Return user_id and the length of their longest login streak.
Sign in to get AI feedback on your SQL queries.