Calculate Employee Contract Durations and Renewal Dates
📖 Scenario: You work in the HR department of a company. You have a table of employees with their contract start and end dates. You want to calculate how many days each employee's contract lasts and find the date when their contract should be renewed by adding 30 days to the end date.
🎯 Goal: Create SQL queries that calculate the duration of each employee's contract in days using DATEDIFF and find the renewal date by adding 30 days to the contract end date using DATE_ADD.
📋 What You'll Learn
Create a table called
employees with columns id, name, contract_start, and contract_end.Insert exactly three employees with specified contract start and end dates.
Write a query to calculate the contract duration in days using
DATEDIFF.Write a query to calculate the renewal date by adding 30 days to
contract_end using DATE_ADD.💡 Why This Matters
🌍 Real World
HR departments often need to track contract durations and renewal dates to manage employee agreements efficiently.
💼 Career
Knowing how to use date arithmetic functions like DATEDIFF and DATE_ADD is essential for database analysts and developers working with time-based data.
Progress0 / 4 steps