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 DifficultyHard SQL
The problem is asking for the id of the row with the maximum value in a table with two columns, "id" and "value". An example input and output is given.
About this solution: The candidate's solution is correct and demonstrates a good understanding of SQL. The solution is also efficient, as it only requires one pass through the table.
Nov 25
Databases / SQL DifficultyHard SQL
This technical problem deals with getting all rows from a table, even if some of the rows are locked. The solution is to write a SQL query that will return all rows from the table.
About this solution: The candidate's solution is correct and demonstrates a good understanding of how to use the NOLOCK hint to read data from a table without being blocked by other processes.
Nov 25
Databases / SQL DifficultyHard SQL
Given a table of transactions, this SQL query will find the total value of all transactions that occurred on each day.
About this solution: This solution is complete and solves the problem. It uses a GROUP BY clause to group together all transactions that occurred on the same date, and then sums the value of those transactions.
Nov 25
Databases / SQL DifficultyHard SQL
Write a SQL query to find all users with the role of 'admin' or 'manager'.
About this solution: The solution above is optimal because it uses the WHERE clause to filter the results.
Nov 25
Databases / SQL DifficultyHard SQL
To find the top 5 employees with the highest salaries, you can write a SQL query that orders the employees by salary in descending order and then limits the result set to the first 5 employees.
About this solution: The candidate's solution is correct and demonstrates a good understanding of SQL. The candidate has correctly used the ORDER BY and LIMIT clauses to sort the table by salary in descending order and then limit the results to the top 5 salaries.
Nov 25
Databases / SQL DifficultyHard SQL
This technical problem involves writing a SQL query that returns the salt for a given user's password. The example input and output are provided in the body of the problem.
About this solution: The candidate's solution is correct and efficient.
Nov 24
Databases / SQL DifficultyHard SQL
A library catalog system must be designed to store and maintain data on books in a library. The system must be able to track titles, authors, ISBNs, publishers, subjects, and publication dates.
About this solution: The solution provided is a good start, but it is missing a few key details. For example, it does not specify what data type each field should be, which is important for database design. Additionally, it does not provide any example queries that could be used to retrieve data from the database, which would be helpful in understanding how the database could be used in practice. Overall, the solution is a good start, but it needs more detail to be truly complete.
Nov 24
Databases / SQL DifficultyHard SQL
The library database should track information on books, patrons, and checkouts. For books, this includes the title, author, and ISBN. For patrons, this includes the name, address, and phone number. For checkouts, this includes the Patron ID, Book ID, Checkout date, and Due date.
About this solution: The solution above is a good start, but it is missing a few key details. First, it does not specify what data should be stored in each table. For example, the books table should store information such as the title, author, and ISBN of each book. Second, the solution does not specify how the data in the tables should be related to each other. For example, the checkouts table should store the patron ID and book ID of each checkout.
Nov 24