SQL Queries

Categories: Code Problem / Data Structures and Algorithms / Recursion (32) Code Problem / Data Structures and Algorithms / Binary Search (30) Code Problem / Data Structures and Algorithms / Linked Lists (26) Code Problem / Data Structures and Algorithms / Backtracking (26) Code Problem / Data Structures and Algorithms / Stacks and Queues (25) Code Problem / Data Structures and Algorithms / Hashing (24) Databases / SQL / Backup and Recovery (19) Code Problem / Data Structures and Algorithms / Arrays and Strings (19) Databases / SQL / Database Normalization (18) Code Problem / Data Structures and Algorithms / Time Complexity (17) Databases / SQL / Locking (16) Databases / SQL / Replication (15) Databases / SQL / SQL Queries (13) Code Problem / Data Structures and Algorithms / Graphs (13) Databases / SQL / Database Security (13)  More...

Recent solutions:

Check these solutions from our community:
Databases / SQL DifficultyMedium SQL
To find the customer with the highest total purchase amount, write a SQL query that select the customer with the maximum TotalPurchaseAmount from the table.
About this solution: The candidate's solution is correct and demonstrates a good understanding of SQL.
Nov 10
Databases / SQL DifficultyMedium SQL
This question asks for the 5th highest salary from the "Employees" table. The example input is a table with id, name, and salary columns, and the example output is a table with a salary column.
About this solution: The candidate's solution correctly finds the 5th highest salary from the "Employees" table. The solution uses the correct SQL syntax and demonstrates a good understanding of the problem.
Nov 04
Databases / SQL DifficultyMedium SQL
This question asks for the 5th highest salary from the "Employees" table. The example input is a table with id, name, and salary columns, and the example output is a table with a salary column.
About this solution: The candidate's solution correctly finds the 5th highest salary from the "Employees" table. The solution uses the correct SQL syntax and demonstrates a good understanding of the problem.
Nov 04
Databases / SQL DifficultyMedium SQL
This question asks for the 5th highest salary from the "Employees" table. The example input is a table with id, name, and salary columns, and the example output is a table with a salary column.
About this solution: The candidate's solution correctly finds the 5th highest salary from the "Employees" table. The solution uses a with statement to create a rating table, which is then used to select the 5th highest salary. This is a valid approach and the solution correctly solves the problem.
Nov 02
Databases / SQL DifficultyMedium SQL
This technical problem involves writing an SQL query that returns the top 3 most purchased products by customers. The example input and output are provided.
About this solution: The solution above is optimal because it uses the ORDER BY and LIMIT clauses to sort the table by product_id in descending order and then limit the results to the top 3.
Oct 31