MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
September
Sun Mon Tue Wed Thu Fri Sat
    5
     
2015
Months
Sep


Sat, Sep 05, 2015 10:48 pm

Updating a date entry from the command line in MySQL

When you update an entry for a column containing dates in a table in a MySQL or MariaDB database, you need to enclose the date in quotes. E.g.:

MariaDB [accounts]> UPDATE Invoices SET Date_Sent='2015-08-29' WHERE Name='Acme';

If you don't the contents of the date field will appear as 0000-00-00.

You also need to enclose the date in quotes when querying a database. E.g.:

MariaDB [accounts]> SELECT * FROM Invoices WHERE Date_Sent='2015-08-29';

Otherwise, you will get an empty set for the query results.

[/software/database/mysql] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo