Returns today’s date as a DATE value without the time portion.
CURRENT_DATE (or its synonym CURDATE()) returns the server’s current date as a DATE value, formatted YYYY-MM-DD, with no time component. Use it whenever you only need the date part.
Filter rows where order_date = CURRENT_DATE. This isolates records created today regardless of the time zone set on the connection.
SELECT *
FROM Orders
WHERE order_date = CURRENT_DATE;
Yes.Set a DATE column’s default to CURRENT_DATE, or insert the function explicitly. The column records the day the row was created.
ALTER TABLE Orders
ADD COLUMN created_on DATE DEFAULT CURRENT_DATE;
NOW() returns a DATETIME. If your column type is DATE, NOW() triggers an implicit cast that can hide time-zone errors. CURRENT_DATE avoids this.
Add or subtract integers to move days forward or back.For instance, CURRENT_DATE - 7 gets the date one week ago.
SELECT COUNT(*)
FROM Orders
WHERE order_date >= CURRENT_DATE - INTERVAL 7 DAY;
1) Use DATE columns when you don’t need the time. 2) Match data types in predicates. 3) Index DATE columns used with CURRENT_DATE for faster lookups.
.
No. It returns only the date portion. Use NOW() if you need time.
They are synonyms. Choose whichever you find more readable.
Yes, but only for column default expressions, not row-level CHECKs, because MariaDB evaluates CHECK at insertion time without built-in functions.