
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can I store ‘0000-00-00’ as a date in MySQL?
For storing the date like ‘0000-00-00’ in a column of MySQL table, we must have to set the SQL mode to ‘allow_invalid_date’. Following example will demonstrate it −
mysql> SET sql_mode = 'allow_invalid_dates'; Query OK, 0 rows affected, 1 warning (0.03 sec) mysql> Create table test_date(date_order date); Query OK, 0 rows affected (0.45 sec) mysql> Insert into test_date(date_order) values('0000-00-00'); Query OK, 1 row affected (0.04 sec) mysql> Select * from test_date; +------------+ | date_order | +------------+ | 0000-00-00 | +------------+ 1 row in set (0.00 sec)
- Related Articles
- Create MySQL datetime column with default 0000-00-00?
- MySQL query to order timestamp in descending order but place the timestamp 0000-00-00 00:00:00 first?
- In which format Year(2) or Year(4) MySQL will return the value of year from date ‘0000-00-00’?
- MySQL query to select date from 00:00 to today’s date
- Convert PHP variable “11:00 AM” to MySQL time format?
- Display hour in KK (00-11) format in Java
- Format hour in HH (00-23) format in Java
- How is it possible to store date such as February 30 in a MySQL date column?
- Construct ∈-NFA of Regular Language L = (00)*1(11)*
- How MySQL evaluates if I store date along with time value in a column having DATE data type?
- How do I format a number as decimal to store it in MySQL?
- How can I store the fixed length string as well as variable length string in the same MySQL table?
- Construct ∈-NFA of Regular Language L = (0+1)*(00+ 11)
- 8085 Program to alternately display 00 and FF in the data field
- How to store data in MySQL as JSON?

Advertisements