List:General Discussion« Previous MessageNext Message »
From:Joerg Bruehe Date:October 1 2009 9:10am
Subject:Re: Adding Fields To Table
View as plain text  
Hi!


prabhat kumar wrote:
> 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; *

The syntax is correct, but one data type is wrong:

A phone number is no numeric type, it is a string of (mostly) digits.

Those who think there is no difference, they are wrong:
1) In a phone number, you may need a leading zero. No numeric type
   supports that, unless you try some formatting which would then affect
   all values and not just selected ones.
2) Just ask yourself whether it makes sense to compute the average phone
   number (yes, the term is misleading).

Similar reasoning applies to other digit strings, like article number,
ISBN (books), SSN (social security number), passport number, etc.


Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  Joerg.Bruehe@stripped
Sun Microsystems GmbH,   Komturstraße 18a,   D-12099 Berlin
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Haering     Muenchen: HRB161028

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