Home > Database > Mysql Tutorial > How to insert null in mysql date

How to insert null in mysql date

coldplay.xixi
Release: 2020-11-16 10:06:36
Original
5987 people have browsed it

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

How to insert null in mysql date

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

use 数据库名;
Copy after login

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

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

How to insert null in mysql date

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

select * from user;
Copy after login

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!

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