Home  >  Article  >  Database  >  How to insert null in mysql date

How to insert null in mysql date

coldplay.xixi
coldplay.xixiOriginal
2020-11-16 10:06:365903browse

Mysql date insert null method: first connect to the MySQL server; then use the use keyword to complete the database selection operation; finally insert a NULL into the date data type, the code is [insert into user (time) values ​​( null)].

How to insert null in mysql date

More related free learning recommendations: mysql tutorial(video)

mysql date method of inserting null:

1. First connect to the MySQL server through the client, example:

mysql -u user -p

How to insert null in mysql date

##2. Use use Keyword, complete the database selection operation, example:

use 数据库名;

How to insert null in mysql date

3. Create a simple table, in which the date time format supports NULL assignment, example:

create table user(
id int(10) auto_increment primary key,
time date);

How to insert null in mysql date

4. Insert a NULL into the date data type in the time field. Example:

insert into user (time) values (null);

How to insert null in mysql date

5. Query the Date data A NULL was successfully inserted into the type, example:

select * from user;

How to insert null in mysql date

The above is the detailed content of How to insert null in mysql date. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn