Cursors

Printing id, start, and end times from a table of data

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.

190
Jan 29
Update prices by 10% using a cursor

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.

180
Nov 27
SQL Query to Find Products That Have Been in Stock for More Than 365 Days

Write a SQL query to find the products that have been in stock for more than 365 days.

163
Nov 23
Printing employee information from a table

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.

137
Nov 14
SQL Query to Find Employees Who Have Been with the Company for More Than 5 Years

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.

174
Nov 12
Calculating Average Salary per Department Using a Cursor

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.

181
Nov 11
Find customers living in the same city as 'John Smith'

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'.

184
Nov 11
Iterate over a table and print name and age for each row.

This problem asks the reader to write a cursor that will iterate over a table and print the name and age of each row.

206
Nov 07