Task (1)
Task (1)
Question:
Write a SQL query to retrieve all employees who were hired within the last 30 days from the
current date.
Instructions:
1. Use the SELECT statement to choose all relevant columns from the employees table.
2. Utilize a date function such as CURRENT_DATE or GETDATE() depending on your SQL
dialect.
3. Apply date arithmetic to filter rows where the hire date is within the last 30 days.
4. Use the WHERE clause to compare hire dates.
SELECT *
FROM employees
Question:
Create a stored procedure named sp_get_employee_hours that retrieves the first name, last
name, and total hours worked on projects for a given employee ID.
Instructions:
IN emp_id INT
)
BEGIN
FROM employees e
END;
Question:
Create a stored procedure named sp_department_employee_count that retrieves the
department ID, department name, and the number of employees in each department, but only for
departments with more than 5 employees.
Instructions: