I asked you the following, which may have been unclear because of the way this forum is organized:
1) Do you think the Realtor's software has to work through a student's knapsack problem to find properties for every query? 2) Have you ever worked with Real Estate software? Any good database software? (These questions do not need an answer, now.) Think of an airline reservation system like Sabre. Thousands of travel agents, airline ticket agents, all accessing it's data, hundreds if not thousands of time, every day, all around the state, country, and yes, even the world. Do you REALLY think that all these queries with multiple constraints (cost, time of departure, direct flight or not, etc.), are all handled by the database doing some 0/1 Knapsack problem algorithm? Of course they aren't handled that way. The whole bloody system would come to a screeching halt! You wrote: "You keep making up problems where a database is actually useful. But I didn't say databases are always useless, far from it, I said *on this problem* a database won't help. What part of "this problem" don't you understand?" First, the OP asked for help writing a query FOR A DATABASE, and said it HAD TO BE FOR THE DATABASE, not a separate program. Second, because queries like the OP mentioned, are routinely handled by A DATABASE. Not only are such databases helpful, for multiple queries, all day long, by thousands of real estate agents and brokers, THEY ARE (almost) ESSENTIAL. I have attempted to point to the moon. I can not walk on the moon with you to prove to you that the moon exists. You either belive the moon exists, or you don't. Perhaps my description of a database indexing was unclear. Let's try again: I have a list of rental properties, in my database. They are: I.D. Address Bdrms Baths Sq. Ft. Rent ================================= 1001 Elm St. 3 2 1400 1,000 1002 Oak St. 2 1 900 750 1003 Ace Dr. 2 2 1100 900 1004 Ash St. 2 2 950 875 Now someone wants to know, do you have any rentals available for 2 bedrooms and 2 baths? You query the database, it looks up in a file or table THAT IS ALREADY MADE UP, and has: 1003 1004 End of table/file. It will now display the records with master ID #'s of 1003 (Ace Dr.), and 1004 (Ash St.) and since this info was ALREADY indexed (by bedroom AND by bath in this example), it's nearly instantly available, for any agent who needs to know. Note that there has been NO searching or sorting of any kind to get this data. IT WAS ALREADY INDEXED, according to these (and more), fields in each record. I agree IN THIS SIMPLE EXAMPLE, it would be just as quick and easy to search through the entire records, but that's wouldn't be true if you had tens of thousands of properties, all over the state or country, in your database. There would be another file or table with the master record for Oak St. in it, and still another file/table which would refer to Elm St. These could be a table of pointers, record id numbers, or whatever the database programmer wanted, but they would all refer to the same properties, indexed the same ways, usually more extensively: location (by zip code), sometimes by school district (important to parents with kids), number of bedrooms, number of baths, cost, sq. ft. of home, type of home (1 story ranch, 2 story Tudor, etc.). With most database software, you are asked what fields should be indexed. You want to index the one's you use to differentiate the queries by (bedrooms, and baths, in this case, at least), but you don't want to index EVERY SINGLE field, because that slows the system down too much, and takes too many resources. Database programmers use all kinds of tricks to (like having the program track the queries and building other indexes if it would help), to improve the programs performance. I thought you were just being a smart-ass, but now I realize your questions were more sincere. It's always hard to really figure out the emotions behind these posts, since I can't see your face, and have no previous knowledge to base my opinions on. Hope that helps, Adak --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---