44

I have noticed something that I do not understand: Why is Nebraska listed after other states that start with an N in their name? One example is on page 2 of the Don't Waste Your Money article J.C. Penny Postpones Store Closings by Sarah Kuta. It lists Nebraska after North Carolina and North Dakota! In case the link goes stale, here is a snippet:

snippet

I have also seen this elsewhere when you have a drop-down list to select a state.

  • That list doesn't seem to be in alphabetical order. It lists North Dakota, Nebraska, New Jersey, Nevada and New York in that order. – Lawrence Apr 17 '17 at 3:43
  • 61
    @Lawrence It's in alphabetical order of the respective two-letter abbreviations. – tchrist Apr 17 '17 at 3:54
  • @tchrist Ah, that would explain it. – Lawrence Apr 17 '17 at 4:36
  • 7
    I'm surprised NE-one would ask this, and that NE-one knew the answer. Just goes to show that NE-thing can happen on SE. – Todd Wilcox Apr 18 '17 at 5:39
  • On which SE site is this question truly on-topic? – Vi0 Apr 18 '17 at 20:18
117

My guess is this: the table was produced from a database. The data there was sorted by state, but using a stored value that was the state abbreviation (they would have used the US Postal Service's official state abbreviations). The actual state name was then assigned via a lookup at the time the report was generated.

This would be consistent with the normal way databases are structured. A quick explanation:

  • Databases are broken into subject matter tables to avoiding duplication. The tables serve as the single place where each element is stored. This minimizes space and simplifies data maintenance. The tables are then linked to each other.

  • The report you cite lists Store Name and City, grouped under State Name. It probably came from a database that had Store information in one table, possibly city information in another table, and state information in still another.

  • State names are various lengths, so they make a poor unique value to use for linking the information in the State table to other tables. That linking value needs to be as short as possible and a standard length. The state abbreviation is perfect for that, it's always exactly two characters. The state name was likely a field in the State table.

  • In your report, the store listings are alphabetical by city name, so it is likely that one of the tables used for the report contained the city name and state abbreviation. The person who created the report sorted everything based on that table and then used the state abbreviation to look up the state name for the report.

The person who produced the report probably overlooked the fact that the alphabetical order for state names is different from that for the abbreviations. But that gives you the state name order in the report:

Abbrev  State Name
 NC     North Carolina
 ND     North Dakota
 NE     Nebraska
 NJ     New Jersey
 NV     Nevada
 NY     New York

  • 6
    Note that the same thing happens earlier in this list: Missouri (MO) precedes Mississippi (MS). – Michael Seifert Apr 17 '17 at 13:56
  • 52
    As a software developer, I'm saddened because one of the first rules of design is to make sure you make things intuitive, and sorting on hidden information is bad programming. – D-Money Apr 17 '17 at 16:30
  • 8
    @D-Money: I suspect they didn't ever intentionally sort, they just got the natural ordering from the table without specifying order, which, if the primary key is the postal abbreviation, would match the ordering of the postal abbreviation. It's not so much an intentional sort on hidden information, it's that they didn't sort, took a brief look and said "Looks good" (missing the slightly out of order display) and called it a day. – ShadowRanger Apr 18 '17 at 0:19
  • 24
    What a coincidence that someone on the Stack Exchange network is a computer programmer! – Andrew Grimm Apr 18 '17 at 4:12
  • 3
    @MrLister: You refuse to coöperate with the naïve, and prefer to reëducate instead? – PLL Apr 18 '17 at 19:11

protected by Mari-Lou A Apr 20 '17 at 20:49

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.