How to delete columns in MySQL?

We can remove, drop, or delete one or more columns in an existing table using the ALTER TABLE statement as follows: ALTER TABLE table_name DROP COLUMN column_name1, column_name2….; To delete columns in MySQL, you would typically use the ALTER TABLE statement along with the DROP COLUMN clause. Here’s the syntax: ALTER TABLE table_name DROP COLUMN … Read more

How to change the column name in MySQL?

While creating a table, we have kept one of the column names incorrectly. To change or rename an existing column name in MySQL, we need to use the ALTER TABLE and CHANGE commands together. The following are the syntax used to rename a column in MySQL: ALTER TABLE table_name CHANGE COLUMN old_column_name new_column_name column_definition [FIRST|AFTER … Read more

How to import a database in MySQL?

Importing database in MySQL is a process of moving data from one place to another place. It is a very useful method for backing up essential data or transferring our data between different locations. For example, we have a contact book database, which is essential to keep it in a secure place. So we need … Read more

How to change the database name in MySQL?

Sometimes we need to change or rename the database name because of its non-meaningful name. To rename the database name, we need first to create a new database into the MySQL server. Next, MySQL provides the mysqldump shell command to create a dumped copy of the selected database and then import all the data into … Read more

How to change the table name in MySQL?

Sometimes our table name is non-meaningful. In that case, we need to change or rename the table name. MySQL provides the following syntax to rename one or more tables in the current database: mysql> RENAME old_table TO new_table; If we want to change more than one table name, use the below syntax: RENAME TABLE old_tab1 … Read more