Show Table Column By Filter
This is used to apply for a column or set of column to apply filter and see a list of column details. The filter of column applied having a command LIKE and plus inside a single quote alone with percentage sing. The application of the command will be as follow
Syntax:-
SHOW COLUMN FROM databaseName.table_name LIKE 'S%';
Figure 1.6 – SHOW Table Column Filter
Alter Table Column
This is one of the query that is used to alter column name already existing in a Table. The action is more useful to alter specific column without changing the entire table structure. The application of the command will be used as follow
Syntax: -
ALTER TABLE tableName CHANGE COLUMN old_columnName new_columnName data_type;
Example: -
ALTER TABLE Persons CHANGE COLUMN City City_Town varchar(255);
Figure 1.7 – Alter Table Column having DataType
Renaming Table Column
This is one of the query that is used to change the exiting column name to a new. column name. The action is more useful to change only the name of the column without touching the column datatype. The application of the command is as follow
Syntax:-
ALTER TABLE tableName RENAME COLUMN old_columnName To new_columnName;
Example: -
ALTER TABLE Persons RENAME COLUMN City_Town To CityTownName;
Figure 1.8 – Renaming Table Column Name
Note : – It is possible to rename more than one column just using all in one statement as follow
Figure 1.9 – Renaming More than one Table Column Name
Adding Customize Table Column
Adding column can also be customize to put a column in the place where to put in the table. To determine the place where to put determine using a keyword ‘AFTER‘. The entire application of the command will be as follow
Syntax: -
ALTER TABLE Person ADD COLUMN newColumnName dataType AFTER existingColumnName;
Example: -
ALTER TABLE Persons ADD COLUMN Country varchar(255) AFTER CityTown;
Figure 1.10 – Adding Customize Column