Using CURRENT_DATE and CURRENT_TIMESTAMP in SQL
📖 Scenario: You are managing a simple employee attendance database. You want to record when employees check in each day.
🎯 Goal: Create a table to store employee check-ins with the current date and timestamp automatically recorded.
📋 What You'll Learn
Create a table named
employee_checkins with columns employee_id (integer), checkin_date (date), and checkin_time (timestamp).Insert a new check-in record for employee with ID 101 using
CURRENT_DATE for the date and CURRENT_TIMESTAMP for the timestamp.Write a query to select all records from
employee_checkins.💡 Why This Matters
🌍 Real World
Tracking employee attendance and timestamps is common in HR and payroll systems.
💼 Career
Understanding how to use CURRENT_DATE and CURRENT_TIMESTAMP is essential for database developers and administrators managing time-sensitive data.
Progress0 / 4 steps