List:General Discussion« Previous MessageNext Message »
From:prabhat kumar Date:October 1 2009 7:24am
Subject:Re: Adding Fields To Table
View as plain text  
You can use :

*ALTER TABLE it ADD COLUMN title varchar(25), phone number integer (6);*

it will add new column after last.

but you can also specify the particular column after you want to add.

like.

*ALTER TABLE it ADD COLUMN title varchar(25), phone number integer (6) AFTER
pusername; *

check more options.
http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

On Thu, Oct 1, 2009 at 12:32 PM, Martijn Tonies <m.tonies@stripped>wrote:

> Hello Carlos,
>
>  I am no doubt very new to MySQL and have been studying the on line
>> manual however I find it a bit complex and don't understand what it's
>> suggesting I do in this case. I created a database called 'staff' and
>> then in that database I created one simple table:
>>
>> mysql> show tables;
>> +-----------------+
>> | Tables_in_staff |
>> +-----------------+
>> | it              |
>> +-----------------+
>> 1 row in set (0.00 sec)
>>
>> mysql> describe it;
>> +----------+-------------+------+-----+---------+-------+
>> | Field    | Type        | Null | Key | Default | Extra |
>> +----------+-------------+------+-----+---------+-------+
>> | name     | varchar(40) | YES  |     | NULL    |       |
>> | username | varchar(20) | YES  |     | NULL    |       |
>> | email    | varchar(20) | YES  |     | NULL    |       |
>> | office   | char(3)     | YES  |     | NULL    |       |
>> +----------+-------------+------+-----+---------+-------+
>> 4 rows in set (0.00 sec)
>>
>> My question is if I would like to add addition fields like 'title' &
>> 'phone number', how can I modify the table fields entry to add more
>> fields? Thanks for any help!
>>
>
> The manual has a section on how to create and modify your metadata,
> I suggest you take a look, it explains all.
>
> With regards,
>
> Martijn Tonies
> Upscene Productions
> http://www.upscene.com
>
> Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
> Anywhere, MySQL, InterBase, NexusDB and Firebird!
>
> Database questions? Check the forum:
> http://www.databasedevelopmentforum.com
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>


-- 
Best Regards,

Prabhat Kumar
MySQL DBA
Datavail-India Mumbai
Mobile     : 91-9987681929
www.datavail.com

My Blog: http://adminlinux.blogspot.com
My LinkedIn: http://www.linkedin.com/in/profileprabhat

Thread
Adding Fields To TableCarlos Williams30 Sep
  • Re: Adding Fields To Tablejoao30 Sep
  • Re: Adding Fields To Tablemos30 Sep
    • Re: Adding Fields To TableCarlos Williams30 Sep
  • Re: Adding Fields To TableRobert Citek30 Sep
  • Re: Adding Fields To TableMartijn Tonies1 Oct
    • Re: Adding Fields To Tableprabhat kumar1 Oct
      • Re: Adding Fields To TableJoerg Bruehe1 Oct
        • Re: Adding Fields To Tableprabhat kumar1 Oct