Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:06:35+00:00 2026-06-06T07:06:35+00:00

I have a online shopping cart, at checkout user enters his zipcode. There are

  • 0

I have a online shopping cart, at checkout user enters his zipcode.

There are 2 payment methods, cash-on-delivery and net-banking. The courier service ships to only certain areas(identified by zipcode). And the allowed list of zipcodes for COD and Net-Banking differ. (length of list = about 2500 for COD, and about 10,000 for latter)

Should I store these lists in database or a flat file?

For database, I will be querying using SELECT, and for file, I can read the entire(or partial) list in array, and then do Binary search on it.

Which one would be faster, considering following points –

  1. There is only one courier service now, but in future there will be more, and with different lists of there own. So I need to search in multiple lists.
  2. There is mostly read, write would be much less. Also the list should be customisable at later point.

I would have selected Database, but I don’t know if it would make things slower, and I don’t want to spend time designing database, when a file might be better.

EDIT:
Say there are 2 courier companies ABC and DEF.
For file I will have 4 files (say) ABC_COD.txt, ABC_net.txt, DEF_COD.txt, DEF_net.txt. So if a customer goes for COD, I search ABC_COD, if not in there, I search DEF_COD and so on. So ok this seems to be costly, but it is also easily extensible.

Now consider database, I will have a table Allowed_zipcodes, with five columns : zipcode(int/varchar(6)), ABC_COD(boolean), ABC_net(boolean), DEF_COD(boolean), DEF_net(boolean). If the x company offers cod for y code, the corresponding column has true, otherwise false.
While this seems good for lookup, adding a company involves a change in schema.

Please consider future changes and design as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:06:37+00:00Added an answer on June 6, 2026 at 7:06 am

    For some reason I think you should look at the magenta framework, isn’t it already in some of the packages?

    But if you want to do it yourself: Just to give you a starting point on the database model:

    carrier
            id(int) | name (varchar)
    
    zipcodes
            start(int) | end(int) | carrier(fk::carrier.id)
    

    For instance:

    carrier
            1 | UPS
            2 | fedex
    
    zipcodes
            1000 | 1199 | 2
            1000 | 1099 | 1
    

    Querying your zipcode and available carriers:

    SELECT carrier.name 
    FROM zipcodes 
    LEFT JOIN carrier ON zip codes.carrier = carrier.id
    WHERE
       zipcodes.end >= :code
    AND
       zipcodes.start <= :code
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have I have an online store with a shopping cart feature
I have a shopping cart in my iPhone app. Once the user is done
I'm creating this online store with a javascript shopping cart. Some products have options,
I am writing an online music store (wow!). I have written a shopping cart
I'm working on an online shopping cart site which is in ASP.NET MVC3. I'm
Is there any online tutorial available for building a shopping cart in cakePHP 1.3
I have a lightweight online shopping site based on JSP and XML, and I'm
I am working on a online shopping website, it will have product images also.
I'm working on an online shopping website. I have an expand / collapse jQuery
I have online dating service. Premium user see a profile on site. profile is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.