Home>Article>Database> How to assign null to mysql date

How to assign null to mysql date

coldplay.xixi
coldplay.xixi Original
2020-11-04 15:56:08 3953browse

Mysql date assignment method to null: First connect to the MySQL server through the client, use the use keyword to complete the database selection operation; then create a table and insert NULL into the date data type in the time field.

How to assign null to mysql date

Mysql date assignment method to null:

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

mysql -u user -p

How to assign null to mysql date

2. Use the use keyword to complete the database selection operation. Example:

use database name;

How to assign null to 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 assign null to mysql date

4. Think of the time field Insert a NULL into the date data type in, example:

insert into user (time) values (null);

How to assign null to mysql date

5. Check, a NULL is successfully inserted into the Date data type, example:

select * from user;

How to assign null to mysql date

More related free learning recommendations:mysql tutorial(video)

The above is the detailed content of How to assign null to 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