Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Database modelling - relevance issue
Old 08-21-2007, 07:54 AM Database modelling - relevance issue
Junior Talker

Posts: 4
Name: Xasho Wahsh
Trades: 0
I have a problem regarding the modelling of a database for a website that requires relevance in its search..

This is the scenario:

say we have a couple of tables consisting of cities in a country:

table 1: country
-------------
#cities
New York
L.A
Chicago
Boston
Miami

These are all in different positions(coodinates) in the country, what I want to do here is determine their posistion in relationship to eachother.

I E New york has a distance to miami but another distance to boston and a third to L.A and so on.

When I search this database using the phrase "New york" I want to be able to know the distances to all other cities in the table aswell.

I know of 2 ways of doing this:

1. Setting up a distances and match them in the search via a table as following:

Distances
----------
#New York #Boston etc.
boston 25 km Chicago 50 km
L.A 500 km Miami 300 km
Chicago 30 km L.A 700 km
and so on...

2. Setting up tables for each city as following:

New York
----------
#city #distances
Boston 25 km
L.A 500 km

and so on...

These two methods would work with only 5 cities or maybe a few more, but my real problem is that I have 290 "cities" in consideration for the database, how can I manage these and get their relevance to eachother in a easier way than having to make 290 tables with far too many posts in each table.
EvinDesign is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-21-2007, 08:02 AM Re: Database modelling - relevance issue
JamieLewis's Avatar
Pretty Much a Big Deal...

Latest Blog Post:
Gooie
Posts: 385
Name: Jamie Lewis
Location: UK
Trades: 0
This is just an idea...

Using basic(~A level) maths you could work out the distance of two cities using their longitude and latitude points... This would save on database space.

Jamie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
JamieLewis is offline
Reply With Quote
View Public Profile Visit JamieLewis's homepage!
 
Old 08-22-2007, 07:51 AM Re: Database modelling - relevance issue
Junior Talker

Posts: 4
Name: Xasho Wahsh
Trades: 0
Thnx for your reply Jamie
Do you have any suggestions on how to solve the matter mathematically?
What would this look like?
I know the maths but the donīt know how to implement this in the code..
EvinDesign is offline
Reply With Quote
View Public Profile
 
Old 08-24-2007, 01:17 PM Re: Database modelling - relevance issue
Super Talker

Posts: 130
Trades: 0
look at the haversine formula and this is also discussed in the following thread http://www.webmaster-talk.com/the-da...de-search.html
__________________
flann

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by flann; 08-24-2007 at 01:21 PM..
flann is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Database modelling - relevance issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13705 seconds with 12 queries