Home > Database > Mysql Tutorial > How to assign null to mysql date

How to assign null to mysql date

coldplay.xixi
Release: 2020-11-04 15:56:08
Original
4128 people have browsed it

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
Copy after login

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);
Copy after login

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);
Copy after login

How to assign null to mysql date

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

select * from user;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template