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 technical problem involves writing a SQL query to find the total number of orders placed by each customer, based on a table of customer order data.
About this solution: The candidate's solution is correct and demonstrates a good understanding of SQL. The solution is also efficient, as it uses the GROUP BY clause to group the orders by customer, and then uses the COUNT() function to count the number of orders for each customer.
Nov 13
Databases / SQL DifficultyMedium SQL
This technical problem involves writing a SQL query to find employees who make more than the average salary.
About this solution: The solution above is optimal because it uses a subquery to find the average salary of all employees, and then uses that value to filter the employees table.
Nov 13
Databases / SQL DifficultyMedium SQL
To find all customers named John Smith, we can run a query against a table of customer names. The query would return all rows where the first name is "John" and the last name is "Smith".
About this solution: The solution above is optimal because it uses the WHERE clause to filter the results to only include customers with the first name "John" and the last name "Smith".
Nov 13
Databases / SQL DifficultyMedium SQL
Write a SQL query to find the customers who have spent more than $1000 in total, given a table of customer orders.
About this solution: The solution above is optimal because it uses the GROUP BY and HAVING clauses to group the orders by customer_id and then filter the results to only include customers who have spent more than $1000.
Nov 13
Databases / SQL DifficultyMedium SQL
This technical problem involves designing a database to store information about a library's patrons, books, and checkout transactions. The database should be able to track patron information (name, ID, address, phone number, date of birth), book information (title, author, ISBN), and checkout information (checkout date, return date, overdue status).
About this solution: The candidate's solution is complete and solves the problem. The candidate demonstrates a good understanding of database design principles.
Nov 13
Databases / SQL DifficultyMedium SQL
Write a SQL query to find the most recent order for each customer in a database.
About this solution: The solution above is optimal because it uses a subquery to find the most recent order date for each customer. This is the most efficient way to solve the problem.
Nov 12
Databases / SQL DifficultyMedium SQL
Given a table with two columns, this SQL query will find the number of rows where the value in the second column is greater than the value in the first column.
About this solution: The candidate's solution is correct and uses an optimal approach.
Nov 12
Databases / SQL DifficultyMedium SQL
This technical problem involves finding the average salary of all employees in the 'Sales' department. This can be accomplished by writing a query to select all employees in the 'Sales' department and then finding the average salary of those employees.
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is efficient and uses the WHERE clause to filter the table to only the rows that have the department 'Sales', which reduces the number of rows that need to be processed by the AVG function.
Nov 12