Cursors

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
This question asks for a cursor that will print the id, start, and end times for each row in a table. The input table has three columns: id, start, and end. The example output should print the id and start and end times for each row in the table, as shown in the example output.
About this solution: The solution above is optimal because it is the simplest solution that will work.
Jan 29
Databases / SQL DifficultyHard SQL
This problem asks the reader to write a cursor to update the prices of all products in a table by 10%. The table is provided as input, and the expected output is also shown.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The candidate has correctly used a cursor to iterate over the table and update the prices of all products by 10%. The candidate's approach is sound and the solution is efficient.
Nov 27
Databases / SQL DifficultyMedium SQL
This problem asks the user to write a cursor that will loop through a table of employee information and print the employee ID and name for each employee.
About this solution: This solution is correct and uses a cursor, which is the recommended approach for this problem.
Nov 14
Databases / SQL DifficultyMedium SQL
To find the employees who have been with the company for more than 5 years, we can write a SQL query that uses the StartDate column in the table to filter the results.
About this solution: This solution is correct and demonstrates a level of completeness. It solves the problem and uses a reasonable approach.
Nov 12
Databases / SQL DifficultyMedium SQL
This technical problem deals with calculating the average salary for each department using a cursor. Given a table of employees and their salaries, the cursor will iterate over the table and calculate the average salary for each department. The output will be a table with the department ID and the corresponding average salary.
About this solution: This solution is correct and demonstrates a good understanding of how to calculate averages in SQL.
Nov 11
Databases / SQL DifficultyMedium SQL
Given a table of customer data, write a SQL query to find the names of all customers who live in the same city as the customer with the name 'John Smith'.
About this solution: The solution above is optimal because it uses a subquery to find the city of John Smith, and then uses that city to find all customers who live in that city.
Nov 11
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 SQL
This problem deals with using a cursor to loop through a table of employee data in order to print the employee's name and salary.
About this solution: The candidate's solution is complete and solves the problem. The candidate has used a cursor to loop through the table and print the employee's name and salary. This is the optimal solution.
Oct 23