473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MySQL question.

Try to create a MySQL tables and don't know how to decide the type of some
fields:

Key: SSN - use int/bigint/char ?
PhoneNumber - int/bigint/char ...?

The reason I asked is that I got a space used exceed the limit with just one
row...

Thanks in advance

Regards,
-Steven
Jul 16 '05 #1
4 2732

"Marcus" <Ju********@aol.com> wrote in message
news:3F**************@aol.com...
Steven wrote:
Try to create a MySQL tables and don't know how to decide the type of some fields:

Key: SSN - use int/bigint/char ?
PhoneNumber - int/bigint/char ...?

The reason I asked is that I got a space used exceed the limit with just one row...

Thanks in advance

Regards,
-Steven


Steven,

I would just use char for both... I have stored phone numbers and just
use char(12) for 000-000-0000. If you want to use an integer type, int
would be the smallest size that would fit a 9 digit SSN... using
UNSIGNED should give you a range up to 2^32-1. I believe you would need
a bigint for a 10 digit phone number... again use UNSIGNED, as that
should give you up to 2^64-1. Hope that helps.

Marcus


Thanks Marcus !

I have to use bigint for the phonenumber before I change it to char...

-Steven

Jul 16 '05 #2
On Sat, 05 Jul 2003 05:29:21 GMT, "Steven" <xu*****@comcast.net> wrote:
Try to create a MySQL tables and don't know how to decide the type of some
fields:

Key: SSN - use int/bigint/char ?
PhoneNumber - int/bigint/char ...?

The reason I asked is that I got a space used exceed the limit with just one
row...


Phone numbers are strings, not really numbers, so definitely use varchar.

Depends how you store them, but even if you don't have characters like (, ), -
and spaces in them, leading zeros are significant, so you don't want them
disappearing if you used a numeric datatype.

Don't know what the rules on SSNs are to say one way or the other, though.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #3
Message-ID: <la********************************@4ax.com> from Andy Hassall
contained the following:
Phone numbers are strings, not really numbers, so definitely use varchar.

Depends how you store them, but even if you don't have characters like (, ), -
and spaces in them, leading zeros are significant, so you don't want them
disappearing if you used a numeric datatype.
My students always make this mistake. I usually ask them "could you use it
in a calculation?" If no, it's not a number.
Don't know what the rules on SSNs are to say one way or the other, though.


Same applies, I'd say.

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 16 '05 #4

"Geoff Berrow" <$b**@ckdog.co.uk> wrote in message
news:su********************************@4ax.com...
Message-ID: <la********************************@4ax.com> from Andy Hassall
contained the following:
Phone numbers are strings, not really numbers, so definitely use varchar.
Depends how you store them, but even if you don't have characters like (, ), -and spaces in them, leading zeros are significant, so you don't want them
disappearing if you used a numeric datatype.
My students always make this mistake. I usually ask them "could you use

it in a calculation?" If no, it's not a number.

Don't know what the rules on SSNs are to say one way or the other,
though.
Same applies, I'd say.

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/


Thank you both and that is a very good point !!

It took me almost two hours to figure out that I need bigint to store the
phone number 9727121049, if I use int, it always changed to 214..... which
I guess is the largest number for int. After I use bigint, it works fine,
but I don't feel that is right though :)

Thanks again.
-Steven
Jul 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Westcoast Sheri | last post by:
To keep track of how many fruits my visitors buy, I use a mySQL database (2 columns: "fruit" and "quantity")....so can we make these following mySQL queries work somehow? (visitor buys 5...
0
by: MJL | last post by:
This is a mysql/php question (but a little more on the mysql side.) The two are so closely related these days, I thought it would be ok to ask here. I installed on my Suse Linux system mysql 4.0...
8
by: Tony Clarke | last post by:
Hi, Just a quick question about performance with MySQL & PHP. If I had a table in a MySQL database with about 100,000 records in it and I need to find the last record is there a quick way to do...
2
by: pieter_hordijk | last post by:
Hi all, maybe this isn't a php question, but a MySQL question. If so I'm sorry for asking you guys to help me :) I know this question is asked often in NGs, but I couldn't find the answer...
2
by: kimshapiro100 | last post by:
Question on PhP, MySQL I am thinking of a consumer internet business for which I will have to have a database driven site built. I am thinking of using PhP, MySQL as the main technologies...
39
by: Mairhtin O'Feannag | last post by:
Hello, I have a client (customer) who asked the question : "Why would I buy and use UDB, when MySql is free?" I had to say I was stunned. I have no experience with MySql, so I was left sort...
1
by: Jim Carlock | last post by:
I have a couple questions about MySQL involving which version of MySQL to use. I'm looking for minimal memory use on a Windows XP machine. Which version would be best for this? And can anyone...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
5
by: news.telia.net | last post by:
Hi! I have a question. I have installed php and mysql on an apache-server on windows and I can't connect to the server. I tried to create a database (since I am trying to learn howto). My...
27
by: gerrymcc | last post by:
Hello, I'm a php/mysql beginner... Is there any way of making the mysql command line client full-screen? Sometimes it's easier to use the client than go thru php, but since it's only about 80...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.