I want to add a column in Customers table. The name of the column which I want to add, is Phone_no. Now if I want to add the country code along with the Phone_no field , then what would be the data type of Phone_no ? e.g. the Phone_no is +918884560909 , Then what would be the data type of Phone_no field?
Asked
Active
Viewed 40 times
3 Answers
0
If you want to add the number with special symbol like +
, then use varchar for it like:
varchar(20)

Mayank Pandeyz
- 25,704
- 4
- 40
- 59
-
Thanks. What is the difference between Varchar and Varchar2?? – diya May 22 '17 at 05:14
-
There is no varchar2 data type in mysql, that's an oracle data type. – Shadow May 22 '17 at 05:15
-
varchar2 is present in oracle only. Check this: http://stackoverflow.com/questions/1171196/what-is-the-difference-between-varchar-and-varchar2 – Mayank Pandeyz May 22 '17 at 05:15
0
If you prefer one field name it as varchar(expected_size). If you prefer two fields you can name one field as country code (varchar) and other as phone_no(number). Go through Oracle documentation for all available datatypes.

Amarnath Reddy Dornala
- 179
- 2
- 13
0
ALTER TABLE Customers ADD COLUMN Phone-no varchar(13);
You could just store number without +
. In that case you could store number as bigint

carpe_diem
- 1
- 2
-
Storing a phone number as bigint is often a bad idea since it will drop leading zeroes. – Kaoru May 22 '17 at 05:20
-