Buy Aceon | Cheap Aceon | Buy Aceon Online Forum Index Buy Aceon | Cheap Aceon | Buy Aceon Online
Buy Aceon | Cheap Aceon | Buy Aceon Online
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   GalleriesGalleries   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is it a good idea to use an integer column for sto

 
Post new topic   Reply to topic    Buy Aceon | Cheap Aceon | Buy Aceon Online Forum Index -> Buy Aceon | Cheap Aceon | Buy Aceon Online
View previous topic :: View next topic  
Author Message
cheapbag214s




Joined: 27 Jun 2013
Posts: 16004
Read: 0 topics

Warns: 0/5
Location: England

PostPosted: Wed 0:29, 14 Aug 2013    Post subject: Is it a good idea to use an integer column for sto

Could it be smart to use an integer column for storing US ZIP codes inside a database
Both would satisfy the requirements of the data, if we assume that there aren't any international concerns. In the past we've generally just gone the text route, but I wondered if anyone does the opposite? Just from brief comparison it looks such as the integer method has two clear advantages:
It is,[link widoczny dla zalogowanych], by means of its nature,[link widoczny dla zalogowanych], automatically restricted to numerics only (whereas without validation the written text style could store letters and such which aren't, to my knowledge, ever valid inside a ZIP code). It doesn't mean we could/would/should forgo validating user input as normal, though!
Also, it seems like it wouldn't hurt display output much. It's trivial to slap a ToString() on the numeric value,[link widoczny dla zalogowanych], use simple string manipulation to insert a hyphen or space or whatever for that +4 extension, and employ string formatting to restore leading zeroes.
Is there something that would discourage using int as a datatype for US-only ZIP codes?
Numbers should mean something numeric. ZIP codes don't add or subtract or participate in any numeric operations. 12309 - 12345 does not compute the distance from downtown Schenectady to my neighborhood,[link widoczny dla zalogowanych].
Granted, for ZIP codes, we're not confused. However,[link widoczny dla zalogowanych], for other number-like fields, it may be confusing.
Since ZIP codes aren't numbers -- they just happen to be coded having a restricted alphabet -- I suggest avoiding a numeric field. The 1-byte saving isn't worth much. And i believe that that meaning is more important compared to byte.
Plus the leading-zero issue means you not storing the client real data,[link widoczny dla zalogowanych], you storing some adjusted version from it that will need mental gymnastics to consider you have to look out for too-short codes. And let's say they included the +4?
There no benefit to storing them in numeric format that I can see. The only real operation I ever done on zip codes is by using them in long/lat calculations which requires you to treat them like strings anyway: you just grab the first 3 characters (leading zero problem again). Tom May 21 '09 at 15:43
Normally you would employ a non-numerical datatype like a varchar which may permit more zip code types. If you're dead set on only allowing 5 digit [XXXXX] or 9 digit [XXXXX-XXXX] zip codes, you can then make use of a char(5) or char(10), but I would not recommend it. Varchar may be the safest and many sane choice.
Edit: It should be also noted that if you do not intend on doing numerical calculations about the field,[link widoczny dla zalogowanych], you shouldn't use a numerical data type. ZIP Code is a not really a number in the sense that you simply add or subtract against it. It is just a string that happens to be made up typically of numbers, which means you should avoid using numerical data types for this.
From the technical standpoint,[link widoczny dla zalogowanych], some things raised here are fairly trivial. Sometimes with address data cleansing every day - particularly cleansing address data all over the world. It's not a trivial task by any stretch from the imagination. With regards to zip codes, you could store them as an integer even though it may not be "semantically" correct. The fact is, the data is of a numeric form whether, strictly speaking it is considered numeric in value.
It is also very hard to force the user to input correct data if a person from the repercussions is a delay of economic. Users often not have the patience to go in correct data whether it's not immediately obvious. Using a regex is an excellent method of guaranteeing correct data, however if the user enters a value that doesn't conform and they're displayed an error, they may just omit this value altogether or enter something which conforms but is otherwise incorrect. An example [using Canadian postal codes] is you often see A0A 0A0 entered which isn't valid but conforms to the regex for Canadian postal codes. More often than not,[link widoczny dla zalogowanych], this really is entered by users who are forced to give a postal code, however they either have no idea what it's or do not have everything correct.
One suggestion is to validate the whole of the entry like a unit validating the zip code is correct when compared with all of those other address. If it's incorrect, then offering alternate valid zip codes for the address will make it more convenient for these phones input valid data. Likewise, when the zip code is correct for that street address,[link widoczny dla zalogowanych], but the street number falls outside the domain of that zipcode, then offer alternate street numbers for that zip code/street combination.
相关的主题文章:


http://www.luntacunt.fora.pl/tips-tricks,8/innovation-and-a-diversified-approach-typifies-tim,7470.html#7734

http://www.portfolk.fora.pl/koncerty,1/in-a-while-spun1,1802.html#2254

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

http://www.compazinegtccv.fora.pl/what-say-watery-smile-work-during-quiet-breath-ambien-strengths-loove-you-iscouraged,1/buying-few-toms-boots-is-ordinarily-getting-a-pair,2778.html#2802

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

[link widoczny dla zalogowanych]

http://www.nifedipinerbzzp.fora.pl/most-often-metformin-hci-1000-mg-augmentin-generic-equipment,1/best-ski-resorts-on-the-u-spun4,10047.html#10295


The post has been approved 0 times
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    Buy Aceon | Cheap Aceon | Buy Aceon Online Forum Index -> Buy Aceon | Cheap Aceon | Buy Aceon Online All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2005 phpBB Group
Regulamin