Using NOW, CURDATE, and CURTIME in MySQL
📖 Scenario: You are managing a small online store database. You want to keep track of when orders are placed by storing the full date and time, just the date, and just the time separately for analysis.
🎯 Goal: Build a simple MySQL table to store order timestamps using the NOW(), CURDATE(), and CURTIME() functions.
📋 What You'll Learn
Create a table called
orders with columns order_id, order_datetime, order_date, and order_time.Insert one row into
orders using NOW() for order_datetime, CURDATE() for order_date, and CURTIME() for order_time.Select all columns from the
orders table to see the stored timestamps.💡 Why This Matters
🌍 Real World
Tracking order times helps businesses analyze sales patterns and improve customer service.
💼 Career
Database developers and analysts often use date and time functions to manage and report on time-sensitive data.
Progress0 / 4 steps