Databases / SQL

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
This problem asks the reader to write a cursor that will iterate over a table and print the name and age of each row.
About this solution: The candidate's solution is complete and solves the problem. The candidate has taken a general approach of using a cursor to iterate over the table and print the name and age of each row.
Nov 07
Databases / SQL DifficultyMedium SQL
This technical problem involves writing a SQL query to find customers who have placed an order with a value greater than $100. The example input provides sample data for a customers table and an orders table . The expected output is a list of customer ids and names who have placed an order with a value greater than $100.
About this solution: The solution above is optimal because it uses a JOIN to combine the two tables and then filters the results to only include customers who have placed an order with a value greater than $100.
Nov 07
Databases / SQL DifficultyMedium SQL
This technical problem involves writing a SQL query that returns the id, name, and salary of all employees with a salary greater than $50,000.
About this solution: The solution above is optimal because it uses the WHERE clause to filter the results.
Nov 07
Databases / SQL DifficultyMedium SQL
This technical problem deals with writing a SQL query that returns the sum of all orders for each product_id. The given table has a schema with three columns: order_id, product_ id, and quantity. An example input and output is also provided.
About this solution: This solution is complete and solves the problem. The approach is straightforward and easy to follow.
Nov 07
Databases / SQL DifficultyMedium SQL
This technical problem deals with writing a SQL query to find all the users who are in more than one role. The user table, role table, and user role table are provided, and the expected output is also given.
About this solution: The candidate's solution is complete and solves the problem. The approach is straightforward and easy to follow.
Nov 06
Databases / SQL DifficultyMedium SQL
This technical problem involves writing a SQL query that returns the names of customers who have placed orders with a total value of more than $100.
About this solution: The solution above is optimal because it uses a JOIN to combine the orders and customers tables. This allows us to access the name column from the customers table.
Nov 06
Databases / SQL DifficultyMedium SQL
Write a SQL query to find the second highest salary from the employees table. The table has columns for id and salary. The query should return the salary column.
About this solution: The solution above is optimal because it uses a subquery to find the maximum salary and then uses that value to find the second highest salary.
Nov 06
Databases / SQL DifficultyMedium SQL
This problem asks for a SQL query that returns the names and total amounts spent by customers who have made a purchase in the last 30 days.
About this solution: The solution above is optimal because it uses the GROUP BY clause to group the results by customer_id and name, and the SUM() function to calculate the total amount spent by each customer.
Nov 06