Reading:  

Beginners guide to MySQL and MariaDB


Alter statement

 

MySQL ALTER command is useful for changing a name of table, any table field and to add or delete an existing column in a table.

SHOW Columns MySQL

Dropping, Adding or Repositioning a Column:

We can drop existing column name from above MySQL table using DROP Clause in Alter Command:

mysql> ALTER TABLE tmp_book DROP name;
 

MySQL Alter table

 

To Add column to existing table using Add Clause in Alter Command:

mysql> ALTER TABLE tmp_book ADD name varchar(30);


MySQL Alter table

 

More on ALTER TABLE can be found on MySQL doc website, A link to which is given below

https://dev.mysql.com/doc/refman/5.1/en/alter-table.html

You can also watch this Video to understand more

Source: Youtube

Description

In this tutorial, we will cover few topics that will give you a heads on start to build your knowledge on. Topics that we will cover briefly but still providing enough information are listed below

  • Overview
  • Installing on Linux and Windows
  • Some useful admin queries for starters
  • Connection
  • Create Database
  • Drop Database
  • Select Database
  • Data Type
  • Create Table
  • Drop Table
  • Inserting and Selecting data
  • Where Clause
  • Updating and deleting data
  • Like Clause
  • Sorting Result
  • Using Joins
  • Brief introduction to Regex, Transactions and Indexes
  • Alter Command
  • Temporary Tables
  • Database Info
  • Using Sequence
  • Database Export and Import
  • Resetting MySQL/MariaDB Administrator password


Audience

Absolute beginners looking to get a sneak peak into what MySQL. Please remember that this is not a full on guide but a quick introduction to the subject.

Learning Objectives

Get to know MySQL and MariaDB

Author: Subject Coach
Added on: 23rd Jun 2015

You must be logged in as Student to ask a Question.

None just yet!