Town Yard text:
The Confucian School of the practical and practical, line Buddhism Purdue sentient beings, the monastic Kangsheng fidelity, understanding of the easy to change the image. To science and technology to shine a good law, the achievement of a conscience blog.
______________________________________________________________________________________________________
Operating System:ubuntukylin 16.04 LTS 64bit
Mysql:ver 14.14 Distrib 5.7.17, for Linux (x86_64) using Editline Wrapper
Step1:
Log in and show all databases and enter a database
[email protected]:~$ mysql -u admin -penter password: welcome to the mysql monitor. commands end with ; or \g.Your MySQL connection id is 29Server version: 5.7.17-0ubuntu0.16.04.1 (Ubuntu) copyright (c) 2000, 2016, oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or Itsaffiliates. other names may be trademarks of their respectiveowners . type ' help; ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> show databases;+--------------------+| database |+--------------------+| information_ schema | | data | | exception | | logininformation | | usinginformation | | mysql | | performance_schema | | phpmyadmin | | sys |+--- -----------------+9 rows in set (0.00 sec)
mysql> use usinginformation; Reading table information for completion of table and column namesyou can turn off this feature to get a quicker startup W Ith-adatabase changed
Step2:
Show all tables under the current database and view the structure of a table
mysql> show tables;+----------------------------+| tables_in_usinginformation |+----------------------------+| using_engineer | | Using_STM |+----------------------------+2 rows in set (0.00 sec)
mysql> describe using_engineer;+------------------+----------+------+-----+---------+-------+| Field | Type | null | key | default | extra |+------------------+ ----------+------+-----+---------+-------+| id_engineer | char (5) | NO | PRI | NULL | | | using_engineer | bit (1) | NO | | null | | | time_build_stm | char ( | NO | ) | null | | | Time_Abandon_STM | char ( | NO | | NULL ) | |+------------------+----------+------+-----+---------+------ -+4 rows in set (0.00 SEC)
Step3:
Change a non-empty column to a column that can be empty and show the results
Mysql> ALTER TABLE Using_engineer modify time_abandon_stm char (+) null; Query OK, 0 rows affected (0.67 sec) records:0 duplicates:0 warnings:0
mysql> describe using_engineer;+------------------+----------+------+-----+---------+-------+| Field | Type | null | key | default | extra |+------------------+ ----------+------+-----+---------+-------+| id_engineer | char (5) | NO | PRI | NULL | | | using_engineer | bit (1) | NO | | null | | | time_build_stm | char ( | NO | ) | null | | | Time_Abandon_STM | char ( | yes | | null |) |+------------------+----------+------+-----+---------+-------+4 rows in set (0.00 SEC)
Note:
My question:
No null--null no thing, then what's the reverse? Null-> no null would it be OK?
What should I do with null items in a column?
______________________________________________________________________________________________________
If you think this blog post can be improved or the content is outdated, please comment, I will think carefully.
Note: This blog post is only used for scientific research, if the infringement of your interests, please inform me, I will make the appropriate treatment.
This article is from the "calm mind like water, chi just like the pan." Blog, be sure to keep this source http://xinjingzhigang.blog.51cto.com/12262830/1905528
The
mysql5.7 base changes a NOT NULL column to null