Write a SQL query that returns the total quantity of each product ordered by each customer.
About this solution: The candidate's solution correctly returns the total quantity of each product ordered by each customer. The solution uses the GROUP BY clause to group the customer and product IDs together, and then uses the SUM function to calculate the total quantity for each group. The solution is clear and concise.
This technical problem involves writing an SQL query that returns the top 3 most purchased products by customers. The example input and output are provided.
About this solution: The solution above is optimal because it uses the ORDER BY and LIMIT clauses to sort the table by product_id in descending order and then limit the results to the top 3.
This technical problem deals with creating a function that will take in an array of integers and return the sum of all the even numbers in the array.
About this solution: The candidate's solution correctly calculates the sum of all even numbers in the array. However, the solution could be more concise. For example, the candidate could have used the built-in SUM function to calculate the sum, rather than creating a new table.
This technical problem deals with creating a function that will take in an array of integers and return the sum of all the even numbers in the array.
About this solution: The candidate's solution is correct and demonstrates a level of completeness. The candidate's approach is also optimal, making use of a CASE statement to check if the number is even and then returning the number if it is even and 0 if it is not. The SUM function then adds up all the numbers in the column.
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.