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
Given a table with two columns, this SQL query will find the most common value in the second column.
About this solution: The candidate's solution is complete and solves the problem. The approach is straightforward and uses a single query to find the most common value in the second column.
Nov 22
Databases / SQL DifficultyHard SQL
Write a SQL query to find all pairs of rows in a table where the values in the two columns are within 10% of each other.
About this solution: This solution is correct and demonstrates a level of completeness. It solves the problem and uses the correct SQL syntax. The approach is straightforward and easy to understand.
Nov 22
Databases / SQL DifficultyHard SQL
This technical problem deals with writing a function that can take in a database name and table name, and return the number of rows in the table.
About this solution: The candidate's solution is complete and solves the problem. The candidate's approach is to use the COUNT() function, which is an optimal way to count the number of rows in a table.
Nov 22
Databases / SQL DifficultyHard SQL
This technical problem involves writing a SQL query to find the average price of all products in a database. An example product table is provided, and the expected output is the average price of all products in the table.
About this solution: This solution is complete and solves the problem. The approach is straightforward and easy to understand.
Nov 21
Databases / SQL DifficultyHard SQL
This technical problem describes how to write a SQL trigger that will automatically update the "last_updated" column whenever a change is made to any of the other columns in a table. The example input table contains employee data, and the example output shows how the "last_updated" column would be updated after a change is made to one of the other columns.
About this solution: The candidate's solution is correct and demonstrates a good understanding of how to write a SQL trigger.
Nov 21
Databases / SQL DifficultyHard SQL
This technical problem involves writing a SQL query to find users with multiple orders. The example input and output are provided.
About this solution: The solution is correct and demonstrates a level of completeness. The approach is straightforward and easy to follow.
Nov 21
Databases / SQL DifficultyHard SQL
Given two tables, this SQL query finds all customers who have at least one order in each table.
About this solution: The solution above is optimal because it uses the IN operator to check if the customer_id from table1 is in table2.
Nov 21
Databases / SQL DifficultyHard SQL
The goal is to find the number of unique users in a table. The table has the following columns: user_id, name. The query should return the number of unique users. In the example above, the answer would be 3.
About this solution: The candidate's solution is correct and uses an efficient method to count the number of unique users.
Nov 21