How to add more columns in exsiting MySQL table

September 27th, 2011 by Pankaj Joshi Leave a reply »

in our previous  post we discussed how to create table in MySQL Database , lets check now how we can add more columns to existing table .

Step 1) Login to MySQL

we will be using user : demo and password as demouser

mysql -u demo -p demouser

Step 2) use database in which we need to create table , as in our previous post we created database demo we will be using same database

mysql> use demo;

Step 3)  we created table employee , now we will be looking how to add more columns in existing table .lets add one more column address having data type varchar and length as 256

mysql> alter table employee add column address varchar(256) ;

Query OK, 0 rows affected (0.07 sec)

Records: 0  Duplicates: 0  Warnings: 0

here we go we can see that the table is being altered . in our next post we will be discussing how to check the  existing table structure.

Advertisement
  • http://onaxer.com/blog/blog/2011/09/28/how-to-check-table-structure-in-mysql/ How to Check table structure in MySQL | Nix World

    [...] September 28th, 2011 by Pankaj Joshi Leave a reply » in our previous  post we discussed how to  add more columns in MySQL table , lets see how we can check table structure in [...]

blog comments powered by Disqus