 
            Designing Database Schema
Example Prompt:
Example Response:
Related Tasks:
Optimizing SQL Queries
Example Prompt:
Example Response:
Related Tasks:
Writing PL/SQL Procedures
Example Prompt:
Example Response:
CREATE OR REPLACE PROCEDURE calculate_employee_bonuses IS
    CURSOR emp_cursor IS
        SELECT employee_id, salary, performance_rating FROM employees;
    v_bonus NUMBER;
BEGIN
    FOR emp IN emp_cursor LOOP
        -- Calculate bonus based on performance rating
        IF emp.performance_rating = 'Excellent' THEN
            v_bonus := emp.salary * 0.20; -- 20% bonus
        ELSIF emp.performance_rating = 'Good' THEN
            v_bonus := emp.salary * 0.10; -- 10% bonus
        ELSIF emp.performance_rating = 'Average' THEN
            v_bonus := emp.salary * 0.05; -- 5% bonus
        ELSE
            v_bonus := 0; -- No bonus for ratings below Average
        END IF;
        -- Update the employee's bonus in the database (assuming a bonus column exists)
        UPDATE employees
        SET bonus = v_bonus
        WHERE employee_id = emp.employee_id;
    END LOOP;
    COMMIT;
END;
Related Tasks:
Planning Data Migration Strategies
Example Prompt:
Example Response:
Related Tasks:
Creating Reports with SQL
Example Prompt:
Example Response:
SELECT 
    product_id, 
    SUM(quantity_sold) AS total_quantity_sold, 
    SUM(total_amount) AS total_sales_amount, 
    COUNT(sale_id) AS number_of_sales, 
    DATE_TRUNC('month', sale_date) AS sales_month
FROM 
    sales
WHERE 
    sale_date BETWEEN '2023-01-01' AND '2023-12-31'
GROUP BY 
    product_id, sales_month
ORDER BY 
    sales_month, total_sales_amount DESC;
Related Tasks: