I'm currently working on a small project in which I need to insert some data into database tables. What I want to do is to set the default value of a certain column to today's date, but only to today's date.
Is this even possible? I already tried the datatypes DATETIME and TIME and its functions CURRENT_TIMESTAMP() and TIMESTAMP() to set their value. Problem is that I only want to have the today's date in my column, not the date and the time. Does anyone know if that's possible?
Here an example:
CREATE TABLE IF NOT EXISTS Bestellung(
BestellNr MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
Bestelldatum DATE DEFAULT ??? NOT NULL,
FahrerID TINYINT UNSIGNED NOT NULL,
KundenNr SMALLINT UNSIGNED NOT NULL,
FOREIGN KEY(FahrerID) REFERENCES
Fahrer(FahrerID) ON UPDATE CASCADE,
FOREIGN KEY(KundenNr) REFERENCES
Kunde(KundenNr) ON UPDATE CASCADE,
PRIMARY KEY(BestellNr),
INDEX(Bestelldatum)
)