You created a table in which the column with 'NOT NULL'. Suppose you want to change mysql column definition from 'NOT NULL' to 'NULL'. Then how can you change it in mysql. The following mysql query is used to change column from 'NOT NULL' to 'NULL' in mysql.
Alter table table1 change No No int(5) NULL
Now your structure look like this:
Now you can see the column name 'No' is NULL.
Similarly you can change the column definition from NULL to NOT NULL. The mysql query as follows as:
Alter table table1 change No No int(5) NOT NULL
Now the column 'No' changed NULL to NOT NULL.
Related Post:
Mysql Query:
Alter table table_name
change column_name column_name datatype(length) definition
Where, the column name 'No' is NOT NULL. You can see the Null column value is No in above mysql table at first row. Now we are going to change column 'NOT NULL' to 'NULL' in mysql table 'table1'. The mysql query is:
change column_name column_name datatype(length) definition
Change column NOT NULL to NULL in mysql:
Consider the example:
The structure of table1 in database new look like this:
The structure of table1 in database new look like this:
Where, the column name 'No' is NOT NULL. You can see the Null column value is No in above mysql table at first row. Now we are going to change column 'NOT NULL' to 'NULL' in mysql table 'table1'. The mysql query is:
Alter table table1 change No No int(5) NULL
Now your structure look like this:
Now you can see the column name 'No' is NULL.
Change column NULL to NOT NULL in mysql:
Alter table table1 change No No int(5) NOT NULL
Now the column 'No' changed NULL to NOT NULL.
Related Post:
Thanks... Valuable post...
ReplyDelete